jbinfo/mobile-detect-service-provider

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

Installs: 18 411

Dependents: 2

Stars: 17

Watchers: 1

Forks: 5

Open Issues: 1

Language: PHP

v1.1.0 2013-11-19 11:21 UTC

README

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