Mobile-Detect README

The project's README from github.com/serbanghita/Mobile-Detect. As one markdown file: README.md.

Mobile Detect

MobileDetect, PHP mobile detection class

Build status Latest stable version Latest tag Monthly Downloads Total Downloads MIT License

Mobile Detect is a lightweight PHP class for detecting mobile devices (including tablets). It uses the User-Agent string combined with specific HTTP headers to detect the mobile environment.

Before you install

MobileDetect is maintained on one rolling branch per major line. Tags follow the pattern <major>.<minor>.<patch> and always live on the matching branch.

Version Tests Namespace Branch PHP Version Purpose
2.* 2.x tests \Mobile_Detect 2.x >=5.6,<7.0 Deprecated
3.* 3.x tests Detection\MobileDetect 3.x >=7.4,<8.0 LTS
4.* 4.x tests Detection\MobileDetect 4.x >=8.2 (since 4.10.0, previously >=8.0) Current, Recommended

🤝 Supporting

If you are using Mobile Detect open-source package in your production apps, in presentation demos, hobby projects, school projects or so, you can sponsor my work by donating a small amount :+1:.

I'm currently paying for domains, hosting and spend a lot of my family time to maintain the project and planning the future releases. I would highly appreciate any money donations.

Special thanks to:

📃 Documentation

The entire documentation is available on Gitbook: https://docs.mobiledetect.net

👾 Demo

Point your device to: https://demo.mobiledetect.net

🐛 Testing

vendor/bin/phpunit -v -c tests/phpunit.xml --coverage-html .coverage

🤝 Contributing

Please see the Contribute guide for details.

🔒 Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

🎉 Credits

Mobile-Detect (serbanghita/Mobile-Detect)

Searching Database…

这是做什么的?Mobile Detect 是一个轻量级的 PHP 类,它通过读取请求中的 User-Agent 字符串和特定的 HTTP 头,告诉你的服务器访问者是否在使用移动设备(包括平板电脑)。
它是加到我服务端代码里的库,还是需要访问者安装的东西?是一个普通的 PHP 库:你把它包含在自己的后端代码里,访问者照常访问你的网站就行——他们的设备上不需要安装任何东西。
怎么把它加到我的项目里?README 把完整的安装指南放在了 Gitbook(它的文档主页)上;各个发布版本按主版本号分别放在不同的滚动分支上,你只要选择和自己 PHP 版本匹配的分支即可。
除了 PHP,我的服务器还需要装别的东西吗?不需要——它只依靠收到的 HTTP 请求就能工作;README 里没有把数据库、PHP 扩展或其他服务列为依赖要求。
PHP 版本方面有什么要注意的吗?有——目前推荐的 4.x 分支面向的是 PHP 8,所以较老的应用要继续用旧的 2.x 分支(它支持到 PHP 5.6)。
安装之前能不能先试试?可以——README 链接了一个在线演示,你可以用想检测的那台设备打开它,这样就能看到自己的手机或平板是怎么被识别出来的。
它能区分平板和手机吗?可以——平板明确在它的检测范围内,这个类通过同样的 User-Agent 和 HTTP 头检测来识别包括平板在内的移动设备。
用在商业项目里免费吗?免费——Mobile Detect 采用 MIT 许可证,可以免费用于商业应用;作者只是希望用得满意的用户考虑赞助一下项目的维护。
这个项目还在维护吗?还在——它从 2012 年就存在了,按主版本号用滚动分支维护,仓库里还配有用于测试和性能基准的 CI 工作流。
Size
4.3 MB
Stars
10.7K
Age
14y
Commits · 90 Days