exs/php-user-agent-bundle
Symfony bundle that wraps donatj/PhpUserAgent. Register EXSPhpUserAgentBundle, then call PhpUserAgentService::parseUserAgent() on a user-agent string to detect platform, browser, and browser version. Simple service-based access with no extra configuration.
Wrapper for global function in https://github.com/donatj/PhpUserAgent/
Edit composer.json file with # EXS-PhpUserAgentBundle dependency:
//composer.json
//...
"require": {
//other bundles
"exs/php-user-agent-bundle": "^1.0"
},
Save the file and have composer update the project via the command line:
composer update exs/php-user-agent-bundle"
Update the app/AppKernel.php
//app/AppKernel.php
//...
public function registerBundles()
{
$bundles = array(
//Other bundles
new EXS\PhpUserAgentBundle\EXSPhpUserAgentBundle(),
);
// initiate the service
$service = new EXS\PhpUserAgentBundle\Services\PhpUserAgentService();
$service->parseUserAgent(USER_AGENT_STRING_HERE);
// Get the detected platform type
$service->getFlatform();
// Get the detected browser type
$service->getBrowser();
// Get the detected browser version
$service->getVersion();
Anyone and everyone is welcome to contribute.
If you have any questions or suggestions please let us know.
How can I help you explore Laravel packages today?