grottopress / mobile-detector
检测移动设备和用户代理。
v1.0.0
2023-05-31 15:58 UTC
Requires
- php: >=7.0
- mobiledetect/mobiledetectlib: ^2.8
Requires (Dev)
README
描述
检测移动设备和用户代理。这是Mobile_Detect库的扩展
安装
通过composer安装:composer require grottopress/mobile-detector
用法
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
开发
使用composer run test运行测试。
贡献
- 分支操作
- 切换到
master分支:git checkout master - 创建您的功能分支:
git checkout -b my-new-feature - 进行更改,根据需要更新更改日志和文档。
- 提交更改:
git commit - 推送到分支:
git push origin my-new-feature - 针对
GrottoPress:master分支提交新的Pull Request。