PHPackages                             advicerobo/browserparser - 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. advicerobo/browserparser

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

advicerobo/browserparser
========================

Useragent sniffing library for PHP (PHP 8 compatible fork)

0596↓50%PHP

Since Feb 19Pushed 2y agoCompare

[ Source](https://github.com/advicegames/Parser-PHP)[ Packagist](https://packagist.org/packages/advicerobo/browserparser)[ RSS](/packages/advicerobo-browserparser/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

> **This fork is required because the project seems to be abandoned, but there are some php 8.2 fixes required. See =&gt; [WhichBrowser#673](https://github.com/WhichBrowser/Parser-PHP/pull/673)****We have kept the same namespace, so you just have to replace nadar/parser with advicerobo/browserparser in your composer.json**

This is an extremely complicated and almost completely useless browser sniffing library. Useless because you shouldn't use browser sniffing. So stop right now and go read something about feature detecting instead. I'm serious. Go away. You'll thank me later.

About WhichBrowser
------------------

[](#about-whichbrowser)

**But why *almost completely useless* and not completely useless?**Well, there is always an exception to the rule. There are valid reasons to do browser sniffing: to improve the user experience or to gather intelligence about which browsers are used on your website. My website is html5test.com and I wanted to know which score belongs to which browser. And to do that you need a browser sniffing library.

**Why is it extremely complicated?**
Because everybody lies. Seriously, there is not a single browser that is completely truthful. Almost all browsers say they are Netscape 5 and almost all WebKit browsers say they are based on Gecko. Even Internet Explorer 11 now no longer claims to be IE at all, but instead an unnamed browser that is like Gecko. And it gets worse. That is why it is complicated.

**What kind of information does it give?**You get a nice object which has information about the browser, rendering engine, os and device. It gives you names and versions and even device manufacturer and model. And WhichBrowser is pretty tenacious. It gives you info that others don't. For example:

```
JUC (Linux; U; 2.3.6; zh-cn; GT-I8150; 480*800) UCWEB8.7.4.225/145/800
UC Browser 8.7 on a Samsung Galaxy W running Android 2.3.6

```

Android is never mentioned

```
Mozilla/5.0 (Series40; Nokia501/10.0.2; Profile/MIDP-2.1 Configuration/CLDC-1.1) Gecko/20100401 S40OviBrowser/3.0.0.0.73
Nokia Xpress 3.0.0 on a Nokia Asha 501 running Nokia Asha Platform

```

Despite the useragent header claiming to be a Series40 device, we know it's actually running the Asha Platform and we also know that OviBrowser has been renamed to Nokia Xpress.

```
Opera/9.80 (X11; Linux zvav; U; zh) Presto/2.8.119 Version/11.10
Opera Mini on a Nokia 5230 running Series60 5.0

```

The useragent header looks like Opera 11.10 on Linux, but we know it's Opera Mini. We can even figure out the real operating system and device model from other headers.

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

[](#requirements)

WhichBrowser requires with PHP 7.0 or higher and supports PHP 8. WhichBrowser is compatible with the PSR-4 autoloading standard and follows PSR-1 and PSR-2 coding style.

How to install it
-----------------

[](#how-to-install-it)

You can install WhichBrowser by using Composer - the standard package manager for PHP. The package is called `whichbrowser/parser`.

```
composer require advicerobo/browserparser:"dev-master"

```

You can easily update WhichBrowser by running a simple command.

```
composer update advicerobo/browserparser:"dev-master"

```

You should run this command as often as possible. You might even want to consider setting up a cron job for this purpose.

How to use it
-------------

[](#how-to-use-it)

The first step require the Composer autoloader:

```
