PHPackages                             wolfcast/browser-detection - 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. wolfcast/browser-detection

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

wolfcast/browser-detection
==========================

The Wolfcast BrowserDetection PHP class facilitates the identification of the user's environment such as Web browser, version, platform family, platform version or if it's a mobile device or not.

2.9.9(1y ago)1391.0M—9.2%587LGPL-3.0-or-laterPHPPHP &gt;=5.3.0

Since Aug 3Pushed 1y ago21 watchersCompare

[ Source](https://github.com/Wolfcast/BrowserDetection)[ Packagist](https://packagist.org/packages/wolfcast/browser-detection)[ Docs](https://github.com/Wolfcast/BrowserDetection)[ RSS](/packages/wolfcast-browser-detection/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)DependenciesVersions (13)Used By (7)

BrowserDetection
================

[](#browserdetection)

The [Wolfcast](https://wolfcast.com/) BrowserDetection PHP class facilitates the identification of the user's environment such as Web browser, version, platform family, platform version or if it's a mobile device or not.

This class will try to detect what the user is using from the `HTTP_USER_AGENT` string sent by the Web browser. A good way to use the class would be to gather user statistics or to report the browser and version used for informational purposes. A bad way to use the class would be to serve content based on the browser and version used. **Sites that rely on the user-agent string should be updated to modern techniques, such as feature detection, adaptive layout, and other modern practices.**

Always keep in mind that `HTTP_USER_AGENT` can be easily spoofed by the user.

Features
--------

[](#features)

The [Wolfcast](https://wolfcast.com/) BrowserDetection PHP class is the most accurate detection class. **It has been tested with 14000+ different user agent strings and it have a 99.95% accuracy ratio!**

Natively detects the following browsers:

- Android
- BlackBerry
- BlackBerry Tablet OS
- Chrome
- Edge
- Firebird
- Firefox
- GNU IceCat
- GNU IceWeasel
- iCab
- Internet Explorer
- Internet Explorer Mobile
- Konqueror
- Lynx
- Mozilla
- MSN TV
- Netscape
- Nokia Browser
- Opera
- Opera Mini
- Opera Mobile
- Phoenix
- Safari
- Samsung Internet
- UC Browser

You can also easily add custom rules to support other browsers not natively supported!

Natively detects the following robots:

- Bingbot
- Googlebot
- MSNBot
- W3C Validator
- Yahoo! Multimedia
- Yahoo! Slurp

You can also easily add custom rules to support other robots not natively supported!

Natively detects the following platforms:

- Android
- BlackBerry
- Chrome OS
- FreeBSD
- iOS
- Linux
- Macintosh
- NetBSD
- Nokia
- OpenBSD
- OpenSolaris
- Symbian
- Windows
- Windows CE
- Windows Phone

You can also easily add custom rules to support other platforms not natively supported!

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

[](#requirements)

Requires PHP 5.3 or newer (tested with PHP 8.4.5, 7.4.33 and 5.6.40).

Demo and full documentation
---------------------------

[](#demo-and-full-documentation)

You can try the [live demo](https://wolfcast.com/open-source/browser-detection/tutorial.php) of the class and you can read the [documentation](https://wolfcast.com/open-source/browser-detection/doc/classes/Wolfcast-BrowserDetection.html).

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

[](#installation)

You can add this library as a local, per-project dependency to your project using [Composer](https://getcomposer.org/) ([Packagist link](https://packagist.org/packages/wolfcast/browser-detection)):

```
composer require wolfcast/browser-detection

```

You can also manually install this library by adding `BrowserDetection.php` (found in the `lib` directory) to your project and then `require_once` the library where needed.

Usage
-----

[](#usage)

```
require_once('BrowserDetection.php');

$browser = new Wolfcast\BrowserDetection();
if ($browser->getName() == Wolfcast\BrowserDetection::BROWSER_FIREFOX &&
    $browser->compareVersions($browser->getVersion(), '5.0') >= 0) {
    echo 'You are using FireFox version 5 or greater.';
}

```

History
-------

[](#history)

Correctly identifying what Web browser your users are using is an incredibly complex task. If you ever tried to implement something like this you quickly saw how this can become a code mess. Only a few libraries exist and they often get deprecated and becomes abandonware. This is why we created our own detection engine. We didn't start from scratch. The class is a heavily updated version of Chris Schuld's Browser class version 1.9 (which was unmaintained for a couple of years). Chris' class was based on the original work from Gary White.

License
-------

[](#license)

SPDX-License-Identifier: MIT OR LGPL-3.0-only

###  Health Score

52

—

FairBetter than 96% of packages

Maintenance46

Moderate activity, may be stable

Popularity57

Moderate usage in the ecosystem

Community27

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 98.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 ~286 days

Recently: every ~469 days

Total

12

Last Release

421d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7f750520318aa210588679b4364f66032e023b99d90c43178fcc0ae06831adb6?d=identicon)[Wolfcast](/maintainers/Wolfcast)

---

Top Contributors

[![Wolfcast](https://avatars.githubusercontent.com/u/7795636?v=4)](https://github.com/Wolfcast "Wolfcast (56 commits)")[![TomVision](https://avatars.githubusercontent.com/u/4797429?v=4)](https://github.com/TomVision "TomVision (1 commits)")

---

Tags

browserenvironmentmobileplatformversiondetection

### Embed Badge

![Health badge](/badges/wolfcast-browser-detection/health.svg)

```
[![Health](https://phpackages.com/badges/wolfcast-browser-detection/health.svg)](https://phpackages.com/packages/wolfcast-browser-detection)
```

###  Alternatives

[jenssegers/agent

Desktop/mobile user agent parser with support for Laravel, based on Mobiledetect

4.8k67.8M440](/packages/jenssegers-agent)[hisorange/browser-detect

Browser &amp; Mobile detection package for Laravel.

1.1k10.1M50](/packages/hisorange-browser-detect)[foroco/php-browser-detection

Ultra fast PHP library to detect browser, OS, platform and device type by User-Agent parsing

1554.7M7](/packages/foroco-php-browser-detection)[cbschuld/browser.php

A PHP Class to detect a user's Browser. This encapsulation provides a breakdown of the browser and the version of the browser using the browser's user-agent string. This is not a guaranteed solution but provides an overall accurate way to detect what browser a user is using.

5876.7M19](/packages/cbschuld-browserphp)[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.

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

PHPackages © 2026

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