simplestats / referer-parser
Snowplow Refer(r)er parser for PHP
Installs: 4
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
pkg:composer/simplestats/referer-parser
Requires
- php: >=8.2
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3
- phpunit/phpunit: ^11
- symfony/yaml: ^7
Suggests
- symfony/yaml: Required for YamlConfigReader support
Replaces
README
A modern PHP implementation of referer-parser, the library for extracting traffic data from referer (sic) URLs.
The implementation uses a JSON version of the shared database of known referers found in referers.yml.
🔱 Maintained PHP 8.2+ fork of php-referer-parser by Lars Strojny, with automatic data updates.
✨ Key Features
- 🌍 Parse referer URLs into structured attribution data
- 🧭 Identify traffic source and medium (search, social, email, etc.)
- 📝 Extract search terms from supported search engines
- 📦 Based on Snowplow’s shared referer database
- ⚡ Modern PHP 8.2+ implementation
- 🔁 Regularly updated referer data
🧩 Requirements
- PHP ≥ 8.2
📦 Installation
composer require simplestats/referer-parser
🚀 Usage
use Snowplow\RefererParser\Parser; $parser = new Parser(); $referer = $parser->parse( 'http://www.google.com/search?q=gateway+oracle+cards+denise+linn&hl=en&client=safari', 'http:/www.psychicbazaar.com/shop' ); if ($referer->isKnown()) { echo $referer->medium; // Medium::SEARCH echo $referer->source; // "Google" echo $referer->searchTerm; // "gateway oracle cards denise linn" }
🤝 Contributing
Fork & PR are welcome.
🙏 Credits
- 🧠 Snowplow for the original referer-parser library
- 👤 Lars Strojny for the original php-referer-parser
📜 License
MIT License Copyright © 2026-PRESENT Bogdan Condorachi
MIT License Copyright © 2013-PRESENT Lars Strojny