Update on May 2, 2012:
<a href="https://github.com/dmolsen/ua-parser-php">ua-parser-php</a> is now included in the official
ua-parser repository on GitHub.
Update on February 11, 2012:
<a href="https://github.com/dmolsen/ua-parser-php">ua-parser-php</a> was updated to v1.0.0. The list of supported browsers and devices was greatly expanded. A number of bug fixes were also added by Bryan Shelton.
<a href="https://github.com/dmolsen/ua-parser-php">ua-parser-php</a> is a PHP-based pseudo-port of the
<a href="http://code.google.com/p/ua-parser/">ua-parser</a> project.
ua-parser-php is designed to parse a user agent string and return certain properties like browser name, OS version, and, in some cases, device name.
ua-parser-php utilizes the user agents regex YAML file from
ua-parser but otherwise uses its own set of properties to describe a browser, OS, and device.
ua-parser-php was created as a new browser-detection library for the browser- and feature-detection library Detector.
Using ua-parser-php is straightforward. Simply include it in your project, make the call to parse the user agent and you'll be returned an object with various properties of the user agent. Examples follow:
NOTE: Using this feature will overwrite a number of changes I've made to the
user_agents_regex.yaml file included with the
Thanks to the
ua-parser team for making the core data available to others so we can build our own solutions.