{"id":19773944,"url":"https://github.com/badoo/uap-php-lite","last_synced_at":"2026-01-23T10:15:50.740Z","repository":{"id":66759242,"uuid":"48954647","full_name":"badoo/uap-php-lite","owner":"badoo","description":"PHP implementation of ua-parser without runtime dependencies","archived":false,"fork":false,"pushed_at":"2016-07-24T17:09:40.000Z","size":30,"stargazers_count":2,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-09T14:41:03.038Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/badoo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-01-03T17:33:30.000Z","updated_at":"2017-12-05T17:30:08.000Z","dependencies_parsed_at":"2023-03-21T16:03:49.095Z","dependency_job_id":null,"html_url":"https://github.com/badoo/uap-php-lite","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/badoo/uap-php-lite","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/badoo%2Fuap-php-lite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/badoo%2Fuap-php-lite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/badoo%2Fuap-php-lite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/badoo%2Fuap-php-lite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/badoo","download_url":"https://codeload.github.com/badoo/uap-php-lite/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/badoo%2Fuap-php-lite/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28687417,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-23T05:48:07.525Z","status":"ssl_error","status_checked_at":"2026-01-23T05:48:07.129Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-12T05:11:34.534Z","updated_at":"2026-01-23T10:15:50.562Z","avatar_url":"https://github.com/badoo.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# uap-php-lite\nPHP implementation of ua-parser without runtime dependencies.\n\nAbout 1000 times faster that [PHP get_browser](http://php.net/manual/en/function.get-browser.php) implementation and more accurate (at least for mobile browsers).\n\n## Production dependencies\n- None\n\n## Development dependencies\n- [uap-core](https://github.com/ua-parser/uap-core.git) - The regex file necessary to build language ports of Browserscope's user agent parser.\n- [spyc](https://github.com/mustangostang/spyc) - A simple YAML loader/dumper class for PHP\n\n## Usage instructions\n\n```php\n~\u003e php -a\nphp \u003e require \"./prod/ua_parse.php\";\nphp \u003e $_SERVER['HTTP_USER_AGENT'] = \"Mozilla/5.0 (iPhone; CPU iPhone OS 8_0 like Mac OS X) AppleWebKit/600.1.3 (KHTML, like Gecko) Version/8.0 Mobile/12A4345d Safari/600.1.4\";\nphp \u003e $result = ua_parse($_SERVER['HTTP_USER_AGENT']);\nphp \u003e print_r($result);\nArray\n(\n    [ua] =\u003e Mobile Safari,8,0\n    [os] =\u003e iOS,8,0\n    [device] =\u003e iPhone\n)\n```\n\n## Update/debug\n\n- Use `git clone --recursive` to clone with submodules.\n- Use `./dev/update_regexes.sh` to update uap-core regex file and generate new php snapshot of `regexes.yaml`.\n- Use `php ./dev/ua_test.php test_uap user_agents_list.txt` to run test against list of user agents you want.\n\n## Reasoning for own implementation\n\nWe needed a simple solution with minimal dependincies, as fast as possible.\n\nAlternatives:\n- [Optimization discussion](https://github.com/tobie/ua-parser/issues/306)\n- [Nginx module](https://github.com/MySiteApp/nginx-ua-parse-module)\ncorrupts memory, provide too simplified results (no versions just groups and families)\n- [php implementation](https://github.com/ua-parser/uap-php)\ndepends on composer, symphony and others\n- [lua implementation](https://github.com/tobie/ua-parser/compare/master...sunblock:master)\nagain too simplified version returning groups and families instead browsers and devices, author says it is terrebly slow\n\n### Comparison with [uap-php]()\n\nPreformance gain is insignificant:\n```sh\ndpp@dpp-mac ~/src/uap-php-lite\u003e time php dev/ua_test.php test_uap user_agents_uniq.txt\ntest_uap: 7.020 seconds\nphp dev/ua_test.php test_uap user_agents_uniq.txt  6.45s user 0.06s system 92% cpu 7.049 total\ndpp@dpp-mac ~/src/uap-php-lite\u003e time php dev/ua_test.php test_uap_php user_agents_uniq.txt\ntest_uap_php: 8.457 seconds\nphp dev/ua_test.php test_uap_php user_agents_uniq.txt  7.72s user 0.07s system 91% cpu 8.491 total\ndpp@dpp-mac ~/src/uap-php-lite\u003e wc -l user_agents_uniq.txt\n3295 user_agents_uniq.txt\ndpp@dpp-mac ~/src/uap-php-lite\u003e\n```\n\nBut code size is much smaller and have no dependencies\n```sh\ndpp@dpp-mac ~/src/uap-php-lite\u003e wc -l dev/generate_ua.php prod/ua_parse.php\n136 dev/generate_ua.php\n28 prod/ua_parse.php\n164 total\ndpp@dpp-mac ~/src/uap-php\u003e find bin src -type f|xargs cat |wc -l\n1363\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbadoo%2Fuap-php-lite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbadoo%2Fuap-php-lite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbadoo%2Fuap-php-lite/lists"}