mimmi20 / ua-result
Library to handle useragent parser results
Requires
- php: ~8.5.0 || ~8.6.0
- mimmi20/browser-detector-versioninterface: ^2.0.2
- mimmi20/ua-browser-type: ^13.0.2
- mimmi20/ua-data-interface: ^2.0.1
- mimmi20/ua-device-type: ^13.0.1
Requires (Dev)
- ergebnis/composer-normalize: ^2.52.0
- infection/infection: ^0.35.3
- jbelien/phpstan-sarif-formatter: ^1.2.0
- mimmi20/coding-standard: ^8.0.22
- phpstan/extension-installer: ^1.4.3
- phpstan/phpstan: ^2.2.9
- phpstan/phpstan-deprecation-rules: ^2.0.5
- phpstan/phpstan-phpunit: ^2.0.18
- phpunit/phpunit: ^13.3.2
- rector/rector: ^2.6.4
- shipmonk/composer-dependency-analyser: ^1.8.4
- symplify/phpstan-rules: ^14.13.1
- tomasvotruba/cognitive-complexity: ^1.2.0
- tomasvotruba/type-coverage: ^2.3.6
- tomasvotruba/unused-public: ^2.2.1
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-09-06 08:54:37 UTC
README
Code Status
Description
This library provides a set of classes representing a result of an useragent detection.
Requirements
This library requires PHP 7.4+. Also a PSR-3 compatible logger is required.
Installation
Run the command below to install via Composer
composer require mimmi20/ua-result
The result object
The result object is the main object and contains only other objects.
The browser object
The browser object represents the detected browser.
// get the result by detection or create it $browser = $result->getBrowser(); // get the name $name = $browser->getName(); // get the manufaturer $manCompany = $browser->getManufacturer()->getName(); $manBrand = $browser->getManufacturer()->getBrandName(); // get the version $name = $browser->getVersion()->getVersion(); // get the type $type = $browser->getType()->getName(); $isbot = $browser->getType()->isBot();
The engine object
The engine object represents the detected rendering engine.
// get the result by detection or create it $engine = $result->getEngine(); // get the name $name = $engine->getName(); // get the manufaturer $manCompany = $engine->getManufacturer()->getName(); $manBrand = $engine->getManufacturer()->getBrandName(); // get the version $name = $engine->getVersion()->getVersion();
The device object
The device object represents the detected device.
// get the result by detection or create it $device = $result->getDevice(); // get the (code) name $name = $device->getDeviceName(); // the device may have a different marketing name $mname = $device->getMarketingName(); // get the manufaturer $manCompany = $device->getManufacturer()->getName(); $manBrand = $device->getManufacturer()->getBrandName(); // the device may be a branded version $brand = $device->getBrand()->getBrandName(); // does the device support dual orientation? $dualorien = $device->getDualOrientation(); // get the pointing method $pointing = $device->getPointingMethod(); // get the display dimensions $height = $device->getResolutionHeight(); $width = $device->getResolutionWidth(); // get some more information about the device type $type = $device->getType()->getName(); $isPhone = $device->getType()->isPhone(); $isTablet = $device->getType()->isTablet();
The platform object
The os object represents the detected platform.
// get the result by detection or create it $platform = $result->getOs(); // get the (code) name $name = $platform->getName(); // the platform may have a different marketing name $mname = $platform->getMarketingName(); // get the manufaturer $manCompany = $platform->getManufacturer()->getName(); $manBrand = $platform->getManufacturer()->getBrandName(); // get the version $name = $platform->getVersion()->getVersion();
Issues and feature requests
Please report your issues and ask for new features on the GitHub Issue Tracker at https://github.com/mimmi20/ua-result/issues