A mobile detect ServiceProvider for Silex, based on Mobile-Detect library.
PHP
Latest commit ba9e125 Jul 29, 2015 @jbinfo Merge pull request #3 from bitdeli-chef/master
Add a Bitdeli Badge to README
Permalink
Failed to load latest commit information.
src/Binfo/Silex
.gitignore
LICENSE update documentation Mar 22, 2013
README.md Add a Bitdeli badge to README Jul 29, 2015
composer.json

README.md

MobileDetectServiceProvider

A mobile detect ServiceProvider for Silex, based on Mobile-Detect library.

Fetch

The recommended way to install MobileDetectServiceProvider is through composer.

Just create a composer.json file for your project:

{
    "require": {
        "jbinfo/mobile-detect-service-provider": "~1",
        "silex/silex": "~1"
    }
}

Register

use Silex\Application;
use Binfo\Silex\MobileDetectServiceProvider;

$app = new Application();

$app->register(new MobileDetectServiceProvider());

Usage

if ($app["mobile_detect"]->isMobile()) {
    echo "Mobile device";

} else {
    echo "Desktop device";
}
echo $app["mobile_detect"]->version('iPad');

For more informations check the website of Mobile-Detect library.

Bitdeli Badge