PHPackages                             tekintian/uadetect - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. tekintian/uadetect

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

tekintian/uadetect
==================

Mobile\_Detect is a lightweight PHP class for detecting mobile devices. It uses the User-Agent string combined with specific HTTP headers to detect the mobile environment.

1.0(7y ago)2251MITPHPPHP &gt;=5.0.0

Since Mar 28Pushed 7y ago1 watchersCompare

[ Source](https://github.com/tekintian/uadetect)[ Packagist](https://packagist.org/packages/tekintian/uadetect)[ Docs](https://github.com/tekintian/uadetect)[ RSS](/packages/tekintian-uadetect/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependencies (1)Versions (2)Used By (0)

PHP浏览器检测 手机 PC,平板等 UaDetect
===========================

[](#php浏览器检测-手机-pc平板等-uadetect)

PHP UserAgent detect, 用于检测访问者的 User Agent是属于手机 平板,还是PC, 用户浏览器名称,操作系统版本,是否微信, 谷歌,火狐等浏览器判断.

> 本项目源于

PHP集成方法:
--------

[](#php集成方法)

1. composer require "tekintian/uadetect"

```
# 载入方式
# 采用autoload.php自动载入方式加载
require_once  __DIR__ . 'vendor/autoload.php';

//使用
$detect = new UaDetect();

// Basic detection.
$detect->isMobile();
$detect->isTablet();

// Magic methods.
$detect->isIphone();
$detect->isSamsung();
// [...]

// Alternative to magic methods.
$detect->is('iphone');

// Find the version of component.
$detect->version('Android');

// Additional match method.
$detect->match('regex.*here');

// Browser grade method.
$detect->mobileGrade();

// Batch methods.
$detect->setUserAgent($userAgent);
$detect->setHttpHeaders($httpHeaders);
