mimmi20 / browscap-php-unsorted
Standalone replacement for php's native get_browser() function
Requires
- php: ^7.1
Requires (Dev)
- ergebnis/composer-normalize: ^2.2.2
- friendsofphp/php-cs-fixer: ^2.16.1
- phpunit/phpunit: ^7.5.20 || ^8.5.0
This package is auto-updated.
Last update: 2020-06-27 13:57:05 UTC
README
This is a userland replacement for PHP's native get_browser()
function, which is officially supported by the Browser Capabilities Project.
Forked from https://github.com/GaretJax/phpbrowscap.
Installation
Run the command below to install via Composer
composer require browscap/browscap-php
Then you may identify the current user agent like so:
use phpbrowscap\Browscap; $browscap = new Browscap(); $info = $browscap->getBrowser();
Recommended Setup
It is highly recommended that you disable the auto update functionality, and create a background cron script to perform the update. This way, you do not make another request every time. So your usual usage would look like this:
use phpbrowscap\Browscap; $browscap = new Browscap($cacheDir); $browscap->doAutoUpdate = false; $info = $browscap->getBrowser();
And you could write a cron script such as this, to run once a day:
use phpbrowscap\Browscap; $browscap = new Browscap($cacheDir); $browscap->updateCache();
Issues and feature requests
Please report your issues and ask for new features on the GitHub Issue Tracker at https://github.com/browscap/browscap-php/issues
Please report incorrectly identified User Agents and browser detect in the browscap.ini file here: https://github.com/browscap/browscap/issues