PHPackages                             eprofos/user-agent-analyzer - 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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. eprofos/user-agent-analyzer

ActiveSymfony-bundle[Parsing &amp; Serialization](/categories/parsing)

eprofos/user-agent-analyzer
===========================

A powerful Symfony bundle for user-agent analysis. It provides accurate detection of operating systems (Windows, MacOS, Linux, iOS, Android...), browsers (Chrome, Firefox, Safari...), and device types (Desktop, Mobile, Tablet, TV...). Supports specific version detection and includes advanced handling of special cases like WebViews and compatibility modes. Features comprehensive logging and detailed analysis results.

v2.1.1(10mo ago)182.3k—7.1%7MITPHPPHP &gt;=8.2CI failing

Since Nov 2Pushed 10mo ago3 watchersCompare

[ Source](https://github.com/eprofos/user-agent-analyzer)[ Packagist](https://packagist.org/packages/eprofos/user-agent-analyzer)[ Docs](https://github.com/eprofos/user-agent-analyzer)[ RSS](/packages/eprofos-user-agent-analyzer/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (6)Dependencies (13)Versions (8)Used By (0)

EprofosUserAgentAnalyzerBundle
==============================

[](#eprofosuseragentanalyzerbundle)

A powerful Symfony bundle for user-agent analysis. It provides accurate detection of operating systems (Windows, MacOS, Linux, iOS, Android...), browsers (Chrome, Firefox, Safari...), and device types (Desktop, Mobile, Tablet, TV...). Supports specific version detection and includes advanced handling of special cases like WebViews and compatibility modes.

[![Latest Stable Version](https://camo.githubusercontent.com/d9455528af996082d18a3aece45135de40e63067dc5f60c4d1798e7ed8ac617f/68747470733a2f2f706f7365722e707567782e6f72672f6570726f666f732f757365722d6167656e742d616e616c797a65722f762f737461626c65)](https://packagist.org/packages/eprofos/user-agent-analyzer)[![License](https://camo.githubusercontent.com/dc8014de8a536c85912317ec0175c7bde2a8edc85114db772e775dc11e134dc2/68747470733a2f2f706f7365722e707567782e6f72672f6570726f666f732f757365722d6167656e742d616e616c797a65722f6c6963656e7365)](https://packagist.org/packages/eprofos/user-agent-analyzer)[![Tests](https://github.com/eprofos/user-agent-analyzer/actions/workflows/tests.yml/badge.svg)](https://github.com/eprofos/user-agent-analyzer/actions/workflows/tests.yml)[![PHP Version](https://camo.githubusercontent.com/d840cef9807c8f76051ad687841d67f4d830c84e0d83236968e53124ef6742d5/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344382e322d3838393242462e737667)](https://php.net/)[![Symfony Version](https://camo.githubusercontent.com/e2638daa06ebb8d9d7e2ed6e34ae3af6c07f8ef1d6dc7a746fad879131884e58/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f73796d666f6e792d253345253344372e302d3030303030302e737667)](https://symfony.com/)

Features
--------

[](#features)

- **Operating System Detection**

    - Windows, MacOS, Linux, iOS, Android, and more
    - Version detection with codename support for MacOS
    - Mobile OS variants (MIUI, EMUI, ColorOS, etc.)
    - 64-bit mode detection
- **Browser Detection**

    - Major browsers: Chrome, Firefox, Safari, Edge, Opera
    - Mobile browsers and WebViews
    - Version detection and rendering engine identification
    - Chromium/Gecko/WebKit version tracking
    - Desktop mode detection
- **Device Detection**

    - Device type classification (Desktop, Mobile, Tablet, TV, etc.)
    - Smart device detection (Smart TV, Game Consoles, Car Systems)
    - Touch support detection
    - WebView detection for Android and iOS
- **Advanced Features**

    - Automatic User-Agent detection from current request
    - Comprehensive logging support
    - High accuracy through multiple detection methods
    - Easy integration with Symfony applications
    - Extensive test coverage
    - PSR-3 logging support

Requirements
------------

[](#requirements)

- PHP 8.2 or higher
- Symfony 7.0 or higher

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

[](#installation)

### Using Composer

[](#using-composer)

```
composer require eprofos/user-agent-analyzer
```

### Enable the Bundle

[](#enable-the-bundle)

If you're not using Symfony Flex, add the bundle to your `config/bundles.php`:

```
return [
    // ...
    Eprofos\UserAgentAnalyzerBundle\EprofosUserAgentAnalyzerBundle::class => ['all' => true],
];
```

Usage
-----

[](#usage)

### Basic Usage

[](#basic-usage)

```
use Eprofos\UserAgentAnalyzerBundle\Service\UserAgentAnalyzer;

class YourController
{
    public function someAction(UserAgentAnalyzer $analyzer)
    {
        $result = $analyzer->analyzeCurrentRequest();

        // Access the results
        $osName = $result->getOsName();           // e.g., "Windows"
        $osVersion = $result->getOsVersion();     // e.g., 10.0
        $browserName = $result->getBrowserName(); // e.g., "Chrome"
        $deviceType = $result->getDeviceType();   // e.g., "desktop"

        // Check device type
        $isMobile = $result->isMobile();    // true if device is mobile
        $isDesktop = $result->isDesktop();  // true if device is desktop
        $isTablet = $result->isTablet();    // true if device is tablet

        // Get all information as array
        $allInfo = $result->toArray();
    }
}
```

### Advanced Usage with Touch Support Mode

[](#advanced-usage-with-touch-support-mode)

```
use Eprofos\UserAgentAnalyzerBundle\Service\UserAgentAnalyzer;

class YourController
{
    public function someAction(
        UserAgentAnalyzer $analyzer,
        Request $request
    ) {
    {
        // Analyze current request with touch support detection
        $result = $analyzer->analyzeCurrentRequest(true);

        // Or analyze specific user agent with touch support
        $userAgent = $request->headers->get('User-Agent');
        $result = $analyzer->analyze($userAgent, true);

        // Check for specific browser features
        $isWebView = $result->isBrowserAndroidWebview() || $result->isBrowserIosWebview();
        $isDesktopMode = $result->isBrowserDesktopMode();
        $is64Bit = $result->is64BitsMode();
    }
}
```

### Twig Functions

[](#twig-functions)

The bundle provides several Twig functions for easy device and OS detection in your templates:

```
{# Device Type Detection #}
{% if is_mobile() %}
    {# Mobile-specific content #}
{% endif %}

{% if is_desktop() %}
    {# Desktop-specific content #}
{% endif %}

{% if is_tablet() %}
    {# Tablet-specific content #}
{% endif %}

{# Operating System Detection #}
{% if is_android() %}
    {# Android-specific content #}
{% endif %}

{% if is_windows() %}
    {# Windows-specific content #}
{% endif %}

{% if is_linux() %}
    {# Linux-specific content #}
{% endif %}

{% if is_ios() %}
    {# iOS-specific content #}
{% endif %}

{% if is_macos() %}
    {# macOS-specific content #}
{% endif %}
```

All Twig functions automatically analyze the current request's User-Agent string and return a boolean value indicating whether the condition is met.

Available Methods
-----------------

[](#available-methods)

### Operating System Information

[](#operating-system-information)

- `getOsType()`: Get OS type (desktop, mobile, etc.)
- `getOsFamily()`: Get OS family (windows, macintosh, etc.)
- `getOsName()`: Get OS name
- `getOsVersion()`: Get OS version
- `getOsTitle()`: Get formatted OS name with version

### Browser Information

[](#browser-information)

- `getBrowserName()`: Get browser name
- `getBrowserVersion()`: Get browser version
- `getBrowserTitle()`: Get formatted browser name with version
- `getBrowserChromiumVersion()`: Get Chromium version if applicable
- `getBrowserGeckoVersion()`: Get Gecko version if applicable
- `getBrowserWebkitVersion()`: Get WebKit version if applicable
- `isBrowserChromeOriginal()`: Check if browser is original Chrome
- `isBrowserFirefoxOriginal()`: Check if browser is original Firefox
- `isBrowserSafariOriginal()`: Check if browser is original Safari

### Device Information

[](#device-information)

- `getDeviceType()`: Get device type
- `isMobile()`: Check if device is mobile
- `isDesktop()`: Check if device is desktop
- `isTablet()`: Check if device is tablet
- `isBrowserAndroidWebview()`: Check if Android WebView
- `isBrowserIosWebview()`: Check if iOS WebView
- `isBrowserDesktopMode()`: Check if desktop mode
- `is64BitsMode()`: Check if 64-bit mode

Testing
-------

[](#testing)

```
composer test
```

Quality Tools
-------------

[](#quality-tools)

```
# Run PHP CS Fixer
composer cs-fix

# Run PHPStan
composer phpstan

# Run all quality tools
composer analyze
```

Contributing
------------

[](#contributing)

Feel free to contribute to this bundle by submitting issues and pull requests.

1. Fork the repository
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
4. Push to the branch (`git push origin feature/amazing-feature`)
5. Open a Pull Request

License
-------

[](#license)

This bundle is released under the MIT License. See the bundled [LICENSE](LICENSE) file for details.

Credits
-------

[](#credits)

Developed by [Eprofos](https://www.eprofos.com).

###  Health Score

42

—

FairBetter than 90% of packages

Maintenance53

Moderate activity, may be stable

Popularity32

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 95.2% 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 ~39 days

Recently: every ~59 days

Total

7

Last Release

326d ago

Major Versions

v1.1.0 → v2.0.02024-11-02

PHP version history (2 changes)1.0.0PHP &gt;=8.3

1.0.1PHP &gt;=8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/2a026cd3fd6025d312886e0388d1ace4a588966b566f142b60ac4600941b530f?d=identicon)[eprofos](/maintainers/eprofos)

---

Top Contributors

[![eprofos](https://avatars.githubusercontent.com/u/127096915?v=4)](https://github.com/eprofos "eprofos (20 commits)")[![v25517](https://avatars.githubusercontent.com/u/159024336?v=4)](https://github.com/v25517 "v25517 (1 commits)")

---

Tags

symfonybundlebrowserparsermobileuser agentplatformdesktopdevicedetectionanalyzeros

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/eprofos-user-agent-analyzer/health.svg)

```
[![Health](https://phpackages.com/badges/eprofos-user-agent-analyzer/health.svg)](https://phpackages.com/packages/eprofos-user-agent-analyzer)
```

###  Alternatives

[sulu/sulu

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

1.3k1.3M152](/packages/sulu-sulu)[sylius/sylius

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

8.4k5.6M651](/packages/sylius-sylius)[simplesamlphp/simplesamlphp

A PHP implementation of a SAML 2.0 service provider and identity provider.

1.1k12.4M193](/packages/simplesamlphp-simplesamlphp)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[contao/core-bundle

Contao Open Source CMS

1231.6M2.4k](/packages/contao-core-bundle)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.2M386](/packages/shopware-core)

PHPackages © 2026

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