PHPackages                             mimmi20/detector - 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. mimmi20/detector

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

mimmi20/detector
================

Combined browser- &amp; feature-detection for your app

1.0.0(10y ago)09MITPHPPHP &gt;=5.5.0

Since Aug 29Pushed 10y ago1 watchersCompare

[ Source](https://github.com/mimmi20/Detector)[ Packagist](https://packagist.org/packages/mimmi20/detector)[ RSS](/packages/mimmi20-detector/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (8)Versions (4)Used By (0)

Detector v0.9.5
===============

[](#detector-v095)

Detector is a simple, PHP- and JavaScript-based browser- and feature-detection library that can adapt to new devices &amp; browsers on its own without the need to pull from a central database of browser information.

Detector dynamically creates profiles using a browser's *(mainly)* unique user-agent string as a key. Using [Modernizr](http://modernizr.com/) it records the HTML5 &amp; CSS3 features a requesting browser may or may not support. [PHP implementation of ua-parser](https://github.com/ua-parser/uap-php/tree/master) is used to collect and record any useful information *(like OS or device name)* the user-agent string may contain.

With Detector a developer can serve the appropriate markup, stylesheets, and JavaScript to a requesting browser without being completely dependent on a front-end-only resource loader nor a browser-detection library being up-to-date.

The server-side portion of Detector is based upon [modernizr-server](https://github.com/jamesgpearce/modernizr-server) by James Pearce ([@jamespearce](http://twitter.com/#!/jamespearce)) and the browser-detection library [PHP implementation of ua-parser](https://github.com/ua-parser/uap-php/tree/master). Detector utilizes [Modernizr](http://www.modernizr.com/) for its client-side, feature-detection support.

Demo of Detector
----------------

[](#demo-of-detector)

A very [simple demo of Detector](http://detector.dmolsen.com/) is available for testing. It's also now in production on the [West Virginia University home page](http://www.wvu.edu/).

Features
--------

[](#features)

The following features are as of v0.8.5 of Detector:

- stores features detected with [Modernizr 2.6.1](http://www.modernizr.com/) ([list](http://detector.dmolsen.com/demo/modernizr-listing/)) and browser &amp; device information detected with [PHP implementation of ua-parser](https://github.com/ua-parser/uap-php/tree/master) on the server as part of a browser profile for easy retrieval
- uses the user agent string as a unique key for looking up information (e.g. one profile per user agent)
- majority of tests are run only once per unique user agent string so only one user is ever tested &amp; redirected
- [add your own feature tests](https://github.com/dmolsen/Detector/wiki/Detector-Test-Tutorial) and store the results using Modernizr's addTest() API
- tests can be created that run once per user agent, once per session, or on every request
- version your browser profiles so you can force them to be recreated after adding new tests
- [easily organize browsers into families](https://github.com/dmolsen/Detector/wiki/Detector-Family-Tutorial) based on a mix of supported features &amp; device information
- browser &amp; bots that don't use JavaScript or cookies can still use your site using a default browser profile
- provide default families for search engines and browsers that don't support javascript or cookies so your best side is always showing
- give your mobile users a "desktop" view via family switching (assuming you use a templating system)
- push feature information to the browser via CSS classes and/or a JavaScript object a la Modernizr
- use with a templating system like Mustache to [create a RESS system](https://github.com/dmolsen/Detector/wiki/Templating-with-Detector-&-Mustache-Tutorial)
- confidence checks that help determine if data collected on a per UA basis is correct

Tutorials
---------

[](#tutorials)

- [Adding &amp; Using Detector With Your Application](https://github.com/dmolsen/Detector/wiki/Adding-&-Using-Detector-With-Your-Application)
- [Creating Browser Groupings](https://github.com/dmolsen/Detector/wiki/Detector-Family-Tutorial)
- [Creating Feature Tests for Detector](https://github.com/dmolsen/Detector/wiki/Detector-Test-Tutorial)
- [Pushing Detector Data to the Browser](https://github.com/dmolsen/Detector/wiki/Pushing-Detector-Data-to-the-Browser-Tutorial)
- [Templating with Detector &amp; Mustache](https://github.com/dmolsen/Detector/wiki/Templating-with-Detector-&-Mustache-Tutorial)

More Information
----------------

[](#more-information)

- [How Detector Works](https://github.com/dmolsen/Detector/wiki/How-Detector-Works)
- [RESS, Server-Side Feature-Detection and the Evolution of Responsive Web Design](http://www.dmolsen.com/mobile-in-higher-ed/2012/02/21/ress-and-the-evolution-of-responsive-web-design/)
- [Why I Created Detector](http://www.dmolsen.com/mobile-in-higher-ed/2012/01/18/introducing-detector-combining-browser-feature-detection-for-your-web-app/)

Credits
-------

[](#credits)

First and foremost, thanks to James Pearce ([@jamespearce](http://twitter.com/jamespearce)) for putting together [modernizr-server](https://github.com/jamesgpearce/modernizr-server) and giving me a great base to work from. I also took some of the copy from his README and used it in the section, "Adding Detector to Your Application." Also, thanks to the guys behind [Modernizr](http://www.modernizr.com/) for giving developers a great lib as well as the the ability to expand Modernizr via `Modernizr.addTest()`. Finally, thanks to Bryan Rieger ([@bryanrieger](http://twitter.com/bryanrieger)) &amp; Stephanie Rieger ([@stephanierieger](http://twitter.com/stephanierieger)) of Yiibu and Luke Wroblewski ([@lukew](http://twitter.com/lukew)) for providing inspiration via [Profile](https://github.com/yiibu/profile) and [RESS](http://www.lukew.com/ff/entry.asp?1392) respectively.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 85.4% 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 ~33 days

Total

3

Last Release

3849d ago

Major Versions

0.9.6 → 1.0.02015-11-03

PHP version history (2 changes)0.99PHP &gt;=5.3.3

0.9.6PHP &gt;=5.5.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/5fea77dd303122241a6caac15ea7456607bcb6f5db869fc8fc9eaf3ec0630a84?d=identicon)[mimmi20](/maintainers/mimmi20)

---

Top Contributors

[![dmolsen](https://avatars.githubusercontent.com/u/2746?v=4)](https://github.com/dmolsen "dmolsen (363 commits)")[![mimmi20](https://avatars.githubusercontent.com/u/1120192?v=4)](https://github.com/mimmi20 "mimmi20 (61 commits)")[![isGabe](https://avatars.githubusercontent.com/u/1437322?v=4)](https://github.com/isGabe "isGabe (1 commits)")

---

Tags

detectoruseragentuser agentdevicefeature detectionua-parserYABFDLmodernizr-server

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/mimmi20-detector/health.svg)

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

###  Alternatives

[jenssegers/agent

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

4.8k67.8M440](/packages/jenssegers-agent)[thadafinser/user-agent-parser

UserAgent parsing done right http://useragent.mkf.solutions/

249316.9k2](/packages/thadafinser-user-agent-parser)[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)[woothee/woothee

Cross-language UserAgent classifier library, PHP implementation

108633.5k4](/packages/woothee-woothee)

PHPackages © 2026

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