jbinfo / mobile-detect-service-provider
A mobile detect ServiceProvider for Silex, based on Mobile-Detect library.
Installs: 329 092
Dependents: 0
Suggesters: 0
Security: 0
Stars: 25
Watchers: 2
Forks: 8
Open Issues: 2
Requires
- php: >=5.3.0
- mobiledetect/mobiledetectlib: ~2
- silex/silex: ~1
This package is not auto-updated.
Last update: 2025-01-04 15:55:30 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.