https://github.com/bolt/browsercheck
💻 Detect devices, clients, operating systems, brands and models in Twig
https://github.com/bolt/browsercheck
Last synced: 10 months ago
JSON representation
💻 Detect devices, clients, operating systems, brands and models in Twig
- Host: GitHub
- URL: https://github.com/bolt/browsercheck
- Owner: bolt
- License: mit
- Created: 2020-11-26T12:07:53.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2020-11-26T12:53:59.000Z (about 5 years ago)
- Last Synced: 2025-02-19T08:47:37.521Z (10 months ago)
- Language: PHP
- Size: 4.88 KB
- Stars: 1
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 💻 Bolt Browsercheck Extension
This Bolt extension works with the User-Agent to detect devices (desktop, tablet, mobile, etc.),
clients, operating systems, brands and models.
## How to install
```bash
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
```twig
{{ browsercheck.client.name }}
```
### Get browser version
```twig
{{ browsercheck.client.version }}
```
### Get the operating system name
```twig
{{ browsercheck.os.name }}
```
### Get the operating system version
```twig
{{ browsercheck.os.version }}
```
### How to view all possible properties
There are many more properties available. To print them all,
use:
```twig
{{ dump(browsercheck) }}
```
Behind the scenes, the `browsercheck` Twig global variable is an instance
of [Matomo's Device Detection Library](https://github.com/matomo-org/device-detector).
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
```