PHPackages                             waldemarnt/user-agent-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. waldemarnt/user-agent-bundle

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

waldemarnt/user-agent-bundle
============================

bundle to handle header user-agent versions

v1.0.6(10y ago)31834MITPHP

Since Oct 1Pushed 9y ago1 watchersCompare

[ Source](https://github.com/waldemarnt/UserAgentBundle)[ Packagist](https://packagist.org/packages/waldemarnt/user-agent-bundle)[ RSS](/packages/waldemarnt-user-agent-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (8)Used By (0)

User Agent Version Bundle
=========================

[](#user-agent-version-bundle)

> Suppose that we have an API or a external connection that needs validation by user-agent, by version, this bundle will fall like a glove in your pretty hands.

Usage
-----

[](#usage)

The list is separated by kind.

### Installation

[](#installation)

Add it as dependency in your composer.json

```
    "require": {
        "waldemarnt/user-agent-bundle": "2.*"
    }
```

Update your **AppKernel.php** and add this line

```
    new Wneto\UserAgentBundle\WnetoUserAgentBundle(),
```

### Usage

[](#usage-1)

First of all you need understand how this stuff works. For example, a browser request send headers like this:

```
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.99 Safari/537.36
```

This example was did using POSTMAN, well, lets suppose that i need receive only requests from Mozilla that have version higher than 5.0. What i need to do that? Kepp calm, lets do it! First of all we need the configuration inside the **config.yml** file

```
# you can found a sample inside Wneto/UserAgentBundle/Resources/samples/config/user_agent.yml
wneto_user_agent:
    validation: true
    type: whitelist # blacklist or whitelist. With whitelist all request will be blocked and accept requests only from the setted patterns
    patterns:
        - { pattern: "Mozilla", version: "5.0", operator: ">" }
```

Lets understand, pattern is the name of the agent, the name is before the **/** bar in the agent, **allowed** is a boolean and the **version** will be the version that you need set the rule, the **operator** is used to applicate the rule for example higher than **&gt;** higher of equals than **&gt;=** the same in inverse **&lt;** , **&lt;=**

Ok now in our application we just need add a verification like this one: First inject the service **@user\_agent.validator.user\_agent** in your class.

```
    public function isDeviceAllowed($request){
        if($this->userAgentValidator->isEnabled()) {
            return $this->userAgentValidator->isAllowed($request->headers->get('user-agent'));
        }

        return true;
    }
```

Ok, the magic will happen and we will be happy forever.

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~0 days

Total

7

Last Release

3881d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4347b3e468f0bf579a7e4684e5c877c0151ac32fc0b93a6c111f84fd59219eaa?d=identicon)[waldemarnt](/maintainers/waldemarnt)

---

Top Contributors

[![wcalderipe](https://avatars.githubusercontent.com/u/3832154?v=4)](https://github.com/wcalderipe "wcalderipe (10 commits)")

### Embed Badge

![Health badge](/badges/waldemarnt-user-agent-bundle/health.svg)

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

PHPackages © 2026

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