UA Parser - configuration and setup - no errors, no output

I am trying to get the UA Parser from here to work, but i seem to be missing something

path to my testpage (which is the sample usage page found here:, with a full user-agent string in place of the one in the sample)

path to us parser code

and the structure of the UAParser directory (see attachment)

I do not know if I have composer installed and I am fairly new to namespaces, so simple instructions on what I am doing wrong and how to fix it would be appreciated

NOTE: composer is not installed on the system and I cannot install it.

LVL 25
James RodgersWeb Applications DeveloperAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ray PaseurCommented:
I do not know if I have composer installed...
Probably you do not have composer installed.  It's something you would know about because you actively have to use it.

PHP Namespaces, despite having some fiddly implementation details are just a way of letting you avoid name collisions, much like the directory structure of a file system.  You can have "abc" in two different directories and you use the directory in conjunction with "abc" to disambiguate.

My recommendation: Take some time to learn composer - how to install it, how to use it, set up a few test cases to prove to yourself that you're doing it right.  Then come back to the application.
James RodgersWeb Applications DeveloperAuthor Commented:
Hi Ray,

for the quick reponse, however the site is on a shared server so I will be unable to install composer.

any suggestions on straight up simple parser for php implementations?
Ray PaseurCommented:
You might want to install composer locally on your own machine.  Just a thought.  It's almost a sine-qua-non requirement for web application development these days.

Can you please tell us a little more about what you want to get from UA-Parser?  Why is the user agent important to your application, etc.  There may be other solutions or maybe we can extract the important part out of the Github code.
CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

James RodgersWeb Applications DeveloperAuthor Commented:
I need the user agent details to extract
OS and
browser (type/version)

to create dropdowns for reporting filters

I am  going to loop over stored user agent strings to create unique table listings of the above information, these tables will then be used as the source for dropdown options on a reports page.

This way I will only show options for items that are actually in the listings rather than hard coding (e.g.: iPhone) in a dropdown and having the user select it then ask me why there are no results for iPhone, this also means that I will not have to manually add new device names etc.

I implemented the parser found here, and it worked

but this does not appear to be as detailed as the other parsers I have tried to implement, i.e. the output did not identify the UA as iPhone
Ray PaseurCommented:
Yeah, it looks like anything that can deconstruct HTTP_USER_AGENT would meet most of the requirements.  You may be able to infer device from the OS data.

Here is that string for my desktop Windows 7 with Chrome (whitespace inserted).
(Windows NT 6.1)
(KHTML, like Gecko)

Here's the same for Firefox.
(Windows NT 6.1; rv:40.0)
James RodgersWeb Applications DeveloperAuthor Commented:
Any input on how I can get the original code to work, would much prefer the more recent code verion as it appears to have a larger selection of regex parsers

when I set  it up I  can get  the base parser php to load, but none of the other classes load, i think it   is related to the namespace

include  dirname(__FILE__) . "/UAParser/Parser.php";

Open in new window

Parser.php loads, but none of the other related classes load

in Parser.php there is
namespace UAParser;

use UAParser\Result\Client;

class Parser extends AbstractParser

Open in new window

but i dont see those items being loaded - i.e.: an echo statement on the Parser.php shows but an echo statement in Client.php is not showing
in the use statement

would it be possible/reasonable to to include all the files at the top of my test/implmentation page?
Ray PaseurCommented:
possible/reasonable to to include all the files...
That's why we use Composer!  It handles all of this stuff for you.  Seriously, you almost cannot work without it these days.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
James RodgersWeb Applications DeveloperAuthor Commented:
damn... I am not the system controller, so that's a no go for now

I guess I am stuck with the simple version.

thanks for your input and advice, much appreciated.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.