This package uses the Piwik Device Detector Package and builds a thin wrapper around it.
You can install the package via composer:
composer require gemz/useragent
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->...
# unit tests
composer test
# you'll need a driver for code coverage
composer test-coverage
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
If you discover any security related issues, please email stefan@sriehl.com instead of using the issue tracker.
Gemz.io is maintained by Stefan Riehl. You'll find all open source projects on Gemz.io github.
The MIT License (MIT). Please see License File for more information.