DeviceDetector is a PHP library that parses User Agents and Browser Client Hints to detect devices, clients, operating systems, brands, and models.
The library solves the problem of identifying device and browser information from User Agent strings, which is essential for analytics, content adaptation, and bot detection. It works by parsing User Agent headers and Client Hints through a comprehensive detection system that can identify device types including desktop, tablet, mobile, TV, cars, and consoles, as well as browsers, operating systems, and specific device brands and models. The library offers both full detection capabilities and the option to use specific parsers in isolation, such as a dedicated bot parser for cases where only bot detection is needed.
DeviceDetector suits projects that require reliable device and browser detection in PHP applications, particularly analytics platforms and services that need to categorize traffic by device type. The library supports integration with external caching systems via PSR-6 and PSR-16 compliant caching solutions, allowing performance optimization for high-traffic applications. It can be installed via Composer or used standalone with the included autoloader, and it requires a YAML parser, with Spyc provided as the default option.
The project maintains active engagement with contributions and pull requests, and ports of the library exist for other programming languages beyond PHP. The codebase is organized around a modular parser architecture that allows developers to use only the detection components they need rather than loading the entire library.