grottopress/mobile-detector

检测移动设备和用户代理。

v1.0.0 2023-05-31 15:58 UTC

This package is auto-updated.

Last update: 2024-09-23 14:53:31 UTC


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运行测试。

贡献

  1. 分支操作
  2. 切换到master分支:git checkout master
  3. 创建您的功能分支:git checkout -b my-new-feature
  4. 进行更改,根据需要更新更改日志和文档。
  5. 提交更改:git commit
  6. 推送到分支:git push origin my-new-feature
  7. 针对GrottoPress:master分支提交新的Pull Request