grottopress / mobile-detector
Detect mobile devices and user agents.
Installs: 1 078
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: >=7.0
- mobiledetect/mobiledetectlib: ^2.8
Requires (Dev)
README
Description
Detect mobile devices and user agents. This is an extension of the Mobile_Detect library
Installation
Install via composer: composer require grottopress/mobile-detector
Usage
use GrottoPress\Mobile\Detector; $detector = new Detector(); // Check if is iOS if ($detector->isiOS()) { // } // Check if is android if ($detector->isAndroidOS()) { // } // Check if is smart device if ($detector->isSmart()) { // } // Check if is phone if ($detector->isPhone()) { // } // Check if is tablet if ($detector->isTablet()) { // } // Check if is Samsung tablet if ($detector->isSamsungTablet()) { // } // Detect current device $device = $detector->getDevice(); // Detect current browser $browser = $detector->getBrowser(); // Detect current OS $os = $detector->getOperatingSystem(); // More examples here: https://github.com/serbanghita/Mobile-Detect/wiki/Code-examples
Development
Run tests with composer run test
.
Contributing
- Fork it
- Switch to the
master
branch:git checkout master
- Create your feature branch:
git checkout -b my-new-feature
- Make your changes, updating changelog and documentation as appropriate.
- Commit your changes:
git commit
- Push to the branch:
git push origin my-new-feature
- Submit a new Pull Request against the
GrottoPress:master
branch.