bolt / browsercheck
💻 This Bolt extension works with the User-Agent to detect devices (desktop, tablet, mobile, etc.), clients, operating systems, brands and models.
Installs: 138
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 4
Forks: 1
Open Issues: 0
Type:bolt-extension
Requires
- php: >=7.1.3
- matomo/device-detector: ^4.0
- twig/twig: ^2.12 | ^3.0
Requires (Dev)
- bolt/core: ^4.0.0
- symplify/easy-coding-standard: ^6.0
README
This Bolt extension works with the User-Agent to detect devices (desktop, tablet, mobile, etc.), clients, operating systems, brands and models.
How to install
composer require bolt/browsercheck
How to use
The extension defined a global Twig variable called browsercheck
,
which gives you access to a lot of properties based on the User-Agent
.
Get browser name
{{ browsercheck.client.name }}
Get browser version
{{ browsercheck.client.version }}
Get the operating system name
{{ browsercheck.os.name }}
Get the operating system version
{{ browsercheck.os.version }}
How to view all possible properties
There are many more properties available. To print them all, use:
{{ dump(browsercheck) }}
Behind the scenes, the browsercheck
Twig global variable is an instance
of Matomo's Device Detection Library.
Any method that is available to the DeviceDetector
class is accessible through
the browsercheck
variable defined by this extension.
Running PHPStan and Easy Codings Standard
First, make sure dependencies are installed:
COMPOSER_MEMORY_LIMIT=-1 composer update
And then run ECS:
vendor/bin/ecs check src