gemz / useragent
This package is an easy wrapper for the Piwik Device Detector
Fund package maintenance!
Patreon
Requires
- php: ^8.0.2
- matomo/device-detector: ^6.0
Requires (Dev)
- phpunit/phpunit: ^9.0
- symfony/var-dumper: ^6.0
README
This package uses the Piwik Device Detector Package and builds a thin wrapper around it.
Installation
You can install the package via composer:
composer require gemz/useragent
Usage
use Gemz\Useragent; // static instantiation $parser = Useragent::agent($string); // object instantiation $parser = new Useragent($string); // Get Result $result = $parser->result(); // returns array [ 'isBot' => false, 'browserType' => 'browser', 'browserEngine' => 'Blink', 'browserName' => 'Chrome', 'browserVersion' => '79.0', 'device' => 'desktop', 'deviceModel' => '', 'deviceBrand' => '', 'os' => 'Mac', 'isMobile' => false, ] // Set a new useragent $result = $parser ->for($string) ->result(); // If you need full access to the piwik device detector instance $detector = $parser->parser(); // returns DeviceDetector\DeviceDetector; $detector->...
Testing
# unit tests composer test # you'll need a driver for code coverage composer test-coverage
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email stefan@sriehl.com instead of using the issue tracker.
Credits
Support us
Gemz.io is maintained by Stefan Riehl. You'll find all open source projects on Gemz.io github.
License
The MIT License (MIT). Please see License File for more information.