dev-master
9999999-dev https://github.com/TeckHouse/MDetectBundleMobile device detector bundle for Symfony2 (MDetect Wrapper)
MIT
The Requires
- php >=5.3.2
The Development Requires
by Mauro Foti
by Vito Tardia
mobile device detect mdetect
Mobile device detector bundle for Symfony2 (MDetect Wrapper)
{ "require": { "teckhouse/mdetect-bundle": "dev-master" } }
$ php composer.phar update teckhouse/mdetect-bundle
<?php // app/AppKernel.php public function registerBundles() { $bundles = array( // Yours bundles // [...] // Mobile Detect Bundle new TeckHouse\MDetectBundle\TeckHouseMDetectBundle(), ); }
there is only one parameter :), (*1)
in config.yml:, (*2)
teckhouse_mdetect: inject_value: [ true | false ]
if the injection in request is setted to true you will find the var "$userDeviceType" in request parameters bug that indentify the device type: "mobile", "tablet", "desk"., (*3)
To get the value simple do this:, (*4)
$request->server->get("userDeviceType");
If the injection is setted to "off" you can use the service to get infos about the device:, (*5)
$this->get('teckhouse_mdetect.wrapper');
In any case you can use Twig filter extension to retrive the status in template:, (*6)
{{ getDeviceType() }}
Mobile device detector bundle for Symfony2 (MDetect Wrapper)
MIT
mobile device detect mdetect