PHPackages                             bleuren/agent - 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. bleuren/agent

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

bleuren/agent
=============

Enhanced user agent parser for Laravel

v1.0.1(2y ago)039MITPHPPHP ^8.3

Since Apr 27Pushed 2y ago1 watchersCompare

[ Source](https://github.com/bleuren/agent)[ Packagist](https://packagist.org/packages/bleuren/agent)[ Docs](https://github.com/bleuren/agent)[ RSS](/packages/bleuren-agent/feed)WikiDiscussions main Synced today

READMEChangelog (2)Dependencies (3)Versions (3)Used By (0)

bleuren/agent
=============

[](#bleurenagent)

The `bleuren/agent` package is an enhanced user agent parser for Laravel applications. It provides functionality to detect various types of devices, browsers, operating systems, and crawlers, which enables developers to tailor user experiences based on the detected environment.

Features
--------

[](#features)

- **Device Detection**: Identify whether the user's device is a desktop, tablet, or mobile.
- **Browser Detection**: Detect and return the browser type being used.
- **Platform Detection**: Determine the operating system of the device.
- **Crawler Detection**: Identify bots and crawlers, distinguishing them from regular user traffic.
- **HTTP Headers Analysis**: Manage and analyze HTTP headers related to mobile devices and user-agents.

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

[](#installation)

To install the package, run the following command in your Laravel project:

```
composer require bleuren/agent
```

Usage
-----

[](#usage)

### Device Detection

[](#device-detection)

```
$isDesktop = Agent::isDesktop();
$isMobile = Agent::isMobile();
$isTablet = Agent::isTablet();
```

### Browser and Platform Detection

[](#browser-and-platform-detection)

```
$browser = Agent::browser();
$platform = Agent::platform();
```

### Crawler Detection

[](#crawler-detection)

```
// Check if the current user agent is a robot.
$isRobot = Agent::isRobot();

// Alternatively, the same result can be achieved with isCrawler()
$isCrawler = Agent::isCrawler();

// You can also check for a specific crawler by passing a user agent string.
$isSpecificCrawler = Agent::isCrawler('specific-user-agent-string');

// Retrieve the name of the detected robot/crawler, if any.
$robot = Agent::robot();
```

### HTTP Headers and User-Agent Management

[](#http-headers-and-user-agent-management)

```
Agent::setHttpHeaders(['User-Agent' => $_SERVER['HTTP_USER_AGENT']]);
$httpHeaders = Agent::getHttpHeaders();
$mobileHeaders = Agent::getMobileHeaders();
$cloudFrontHeaders = Agent::getCloudFrontHttpHeaders();

Agent::setUserAgent('specific-user-agent-string');
$userAgent = Agent::getUserAgent();
```

Examples
--------

[](#examples)

```
// Determine the device type: 'desktop', 'mobile', 'tablet', or 'robot'.
$deviceType = Agent::deviceType();

// Browser and platform detection
$browser = Agent::browser();
$platform = Agent::platform();

// Detailed robot detection
if (Agent::isRobot()) {
    $robot = Agent::robot();
}
```

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 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

2

Last Release

797d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/22718976?v=4)[Bleu Ren](/maintainers/bleuren)[@bleuren](https://github.com/bleuren)

---

Top Contributors

[![bleuren](https://avatars.githubusercontent.com/u/22718976?v=4)](https://github.com/bleuren "bleuren (2 commits)")

---

Tags

laravelparsercrawler detectmobile detectuser agentdevice detectbrowser detectos detectrobot detect

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/bleuren-agent/health.svg)

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

###  Alternatives

[donatj/phpuseragentparser

Lightning fast, minimalist PHP UserAgent string parser.

60417.7M72](/packages/donatj-phpuseragentparser)[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3914.6k](/packages/rawilk-profile-filament-plugin)[pumukit/pumukit

Media Portal

6014.6k48](/packages/pumukit-pumukit)[pherum/laravel-bbcode

Parse your BBCode easy with this library.

2531.2k](/packages/pherum-laravel-bbcode)[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.

183.4k](/packages/eprofos-user-agent-analyzer)

PHPackages © 2026

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