Bachir Soussi Chiadmi ad38015ea9 first commit : grave core and admin plugin | 9 лет назад | |
---|---|---|
.. | ||
Source | 9 лет назад | |
CONTRIBUTING.md | 9 лет назад | |
LICENSE.md | 9 лет назад | |
README.md | 9 лет назад |
A simple, streamlined PHP user-agent parser!
Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
You have your choice in user-agent parsers. This one detects all modern browsers in a very light, quick, understandable fashion. It is less than 200 lines of code, and consists of just three regular expressions! It can also correctly identify exotic versions of IE others fail on.
It offers 100% unit test coverage, is installable via Composer, and is very easy to use.
User-agent strings are not a reliable source of OS Version!
I'm much more interested in keeping this thing tiny and accurate than adding niché features and would rather focus on things that can be done well.
All that said, there is the start of a branch to do it I created for a client if you want to poke it, I update it from time to time, but frankly if you need to reliably detect OS Version, using user-agent isn't the way to do it. I'd go with JavaScript.
PHP User Agent is available through Packagist via Composer.
{
"require": {
"donatj/phpuseragentparser": "*"
}
}
$ua_info = parse_user_agent();
/*
array(
'platform' => '[Detected Platform]',
'browser' => '[Detected Browser]',
'version' => '[Detected Browser Version]',
);
*/
More information is available at Donat Studios.