PHPackages                             acsiomatic/device-detector-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. acsiomatic/device-detector-bundle

ActiveSymfony-bundle[Utility &amp; Helpers](/categories/utility)

acsiomatic/device-detector-bundle
=================================

Symfony Bundle for https://github.com/matomo-org/device-detector

0.6.0(1y ago)12202.6k↓59.6%1[2 issues](https://github.com/acsiomatic/device-detector-bundle/issues)MITPHPPHP ^8.1CI passing

Since Nov 29Pushed 3mo ago2 watchersCompare

[ Source](https://github.com/acsiomatic/device-detector-bundle)[ Packagist](https://packagist.org/packages/acsiomatic/device-detector-bundle)[ RSS](/packages/acsiomatic-device-detector-bundle/feed)WikiDiscussions main Synced 3d ago

READMEChangelog (6)Dependencies (10)Versions (7)Used By (0)

AcsiomaticDeviceDetectorBundle
==============================

[](#acsiomaticdevicedetectorbundle)

The `AcsiomaticDeviceDetectorBundle` provides integration of the [DeviceDetector](https://github.com/matomo-org/device-detector) library into the [Symfony](https://symfony.com/) framework.

> [DeviceDetector](https://github.com/matomo-org/device-detector) is a Universal Device Detection library that parses User Agents and Browser Client Hints to detect devices (desktop, tablet, mobile, tv, cars, console, etc.), clients (browsers, feed readers, media players, PIMs, ...), operating systems, brands and models.
>
> From

This bundle provides the [`DeviceDetector` class](https://github.com/matomo-org/device-detector/blob/master/DeviceDetector.php) as [service](https://symfony.com/doc/current/service_container.html#fetching-and-using-services), and [Twig global variable](https://symfony.com/doc/current/templates.html#global-variables).

- [Installation](#installation)
- [Configuration](#configuration)
- [Usage](#usage)
    - [Usage in controllers](#usage-in-controllers)
    - [Usage in Twig](#usage-in-twig)
    - [Usage in route condition](#usage-in-route-condition)
    - [Parsing custom request](#parsing-custom-request)
- [Release Policy](#release-policy)
    - [Dependencies Compatibility Policy](#dependencies-compatibility-policy)

Installation
------------

[](#installation)

You can install the bundle using [Composer](https://getcomposer.org/):

```
composer require acsiomatic/device-detector-bundle
```

Configuration
-------------

[](#configuration)

You can configure the bundle using the `acsiomatic_device_detector` configuration section:

```
# config/packages/acsiomatic_device_detector.yaml

acsiomatic_device_detector:

    # If true, DeviceDetector will trigger parser() when necessary
    auto_parse: true

    # Version truncation behavior, it may assume: major, minor, patch, build, or none
    # By default minor versions will be returned (e.g. X.Y)
    version_truncation: 'minor'

    cache:

        # If null, it will disable caching
        pool: 'cache.app'

    bot:

        # If true getBot() will only return true if a bot was detected (speeds up detection a bit)
        discard_information: false

        # If true, bot detection will completely be skipped (bots will be detected as regular devices then)
        skip_detection: false

    twig:

        # If null, it will not assign Twig variable
        variable_name: 'device'

    routing:

        # If null, it will not tag DeviceDetector as routing condition service
        condition_service_alias: 'device'
```

Usage
-----

[](#usage)

### Usage in controllers

[](#usage-in-controllers)

You can inject `DeviceDetector` as a service. This bundle sets up an instance of this class according to the configurations under the `acsiomatic_device_detector` section in order to provide information about the main request.

```
use DeviceDetector\DeviceDetector;
use Symfony\Component\HttpFoundation\Response;

class MyController
{
    public function index(DeviceDetector $device): Response
    {
        if ($device->isSmartphone()) {
            // ...
        }
    }
}
```

Note

You need to call `$device->parse()` before asking for device's information if `auto_parse` configuration is false.

### Usage in Twig

[](#usage-in-twig)

The `DeviceDetector` service is assigned to the Twig templates as `device` variable.

```
{% if device.isSmartphone %}
    {# ... #}
{% endif %}
```

### Usage in route condition

[](#usage-in-route-condition)

The `DeviceDetector` is tagged as routing condition service.

```
use Symfony\Component\HttpFoundation\Response;

class MyController
{
    #[Route('/page', condition: "service('device').isSmartphone()")]
    public function index(): Response
    {
        // this endpoint is available only for smartphone devices
    }
}
```

### Parsing custom request

[](#parsing-custom-request)

You might want to parse other request than the current one. This bundle provides a service that implements [DeviceDetectorFactoryInterface](src%2FContracts%2FDeviceDetectorFactoryInterface.php). This service provides methods that create fresh `DeviceDetector` instances according to the configurations under the `acsiomatic_device_detector` section, but it doesn't attach them to any request.

Custom parsers
--------------

[](#custom-parsers)

You can inject custom parsers into `DeviceDetector` by providing them as services.

If [autoconfigure](https://symfony.com/doc/current/service_container.html#the-autoconfigure-option) is enabled, the bundle injects custom parsers. Otherwise, you need to add the corresponding tag to each custom parsers:

- `acsiomatic.device_detector.bot_parser`
- `acsiomatic.device_detector.client_parser`
- `acsiomatic.device_detector.device_parser`

Release Policy
--------------

[](#release-policy)

There is a **single** maintained branch per time. This branch targets a minor version.

A maintained version reaches its end-of-life when a new minor version is released.

### Dependencies Compatibility Policy

[](#dependencies-compatibility-policy)

This library is compatible with maintained versions of [PHP](https://www.php.net/supported-versions.php), [Device Detector](https://github.com/matomo-org/device-detector/branches), and [Symfony](https://symfony.com/releases#sf-versions).

###  Health Score

45

—

FairBetter than 91% of packages

Maintenance55

Moderate activity, may be stable

Popularity41

Moderate usage in the ecosystem

Community12

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 88.9% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~283 days

Recently: every ~327 days

Total

6

Last Release

626d ago

PHP version history (4 changes)0.1.0PHP &gt;=7.0

0.3.0PHP ^7.0 || ^8.0

0.4.0PHP ^7.2 || ^8.0

0.6.0PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/4e1aa2e77d3574f9aa318fde02fe0f6113404f44c244529caceed0e1dadf4b66?d=identicon)[renanbr](/maintainers/renanbr)

![](https://www.gravatar.com/avatar/93bd8aad6041bd2caf4b082421ce40fe4b8f69902240ebe09f75cb23120ab924?d=identicon)[Rene Lima](/maintainers/Rene%20Lima)

---

Top Contributors

[![renedelima](https://avatars.githubusercontent.com/u/18712090?v=4)](https://github.com/renedelima "renedelima (16 commits)")[![pierrelemee](https://avatars.githubusercontent.com/u/7372352?v=4)](https://github.com/pierrelemee "pierrelemee (2 commits)")

---

Tags

bot-detectiondetection-librarydevice-detectormobile-detectionphpsymfonysymfony-bundleuser-agentuser agentSymfony Bundledevice detectordetection-librarybot-detectionmobile-detection

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Rector

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/acsiomatic-device-detector-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/acsiomatic-device-detector-bundle/health.svg)](https://phpackages.com/packages/acsiomatic-device-detector-bundle)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.5k5.9M738](/packages/sylius-sylius)[oro/platform

Business Application Platform (BAP)

645143.5k115](/packages/oro-platform)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.4M203](/packages/sulu-sulu)[rcsofttech/audit-trail-bundle

Enterprise-grade, high-performance Symfony audit trail bundle. Automatically track Doctrine entity changes with split-phase architecture, multiple transports (HTTP, Queue, Doctrine), and sensitive data masking.

1189.8k](/packages/rcsofttech-audit-trail-bundle)[jbtronics/settings-bundle

A symfony bundle to easily create typesafe, user-configurable settings for symfony applications

9773.0k3](/packages/jbtronics-settings-bundle)[ahmed-bhs/doctrine-doctor

Runtime analysis tool for Doctrine ORM integrated into Symfony Web Profiler. Unlike static linters, it analyzes actual query execution at runtime to detect performance bottlenecks, security vulnerabilities, and best practice violations during development with real execution context and data.

9410.8k](/packages/ahmed-bhs-doctrine-doctor)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
