misterpaladin / laravel-identify
一个用于识别/检测用户浏览器、设备、操作系统和语言的Laravel 5包提供者
1.1.4
2018-03-27 03:10 UTC
Requires
- php: >=5.5.9
- illuminate/support: 5.*
- sinergi/browser-detector: 6.0.*
Requires (Dev)
- mockery/mockery: 0.9.*
- phpunit/phpunit: 5.3.*
- satooshi/php-coveralls: ^0.7.0
- scrutinizer/ocular: ~1.1
README
Laravel 5 包,用于识别用户的浏览器、操作系统、语言和设备
安装
需要PHP 5.4+ 或 HHVM 3.3+,以及 Composer。
要获取Laravel Identify的最新版本,只需将以下行添加到您的composer.json文件的require块中。
"unicodeveloper/laravel-identify": "1.1.*"
然后,您需要运行composer install或composer update来下载它并更新自动加载器。
一旦安装了Laravel Identify,您需要注册服务提供者。打开config/app.php,并在providers键中添加以下内容。
Unicodeveloper\Identify\IdentifyServiceProvider::class
同时,也可以这样注册外观
'aliases' => [ ... 'Identify' => Unicodeveloper\Identify\Facades\IdentifyFacade::class, ... ]
配置
要开始使用,您需要发布所有供应商资源
$ php artisan vendor:publish --provider="Unicodeveloper\Identify\IdentifyServiceProvider"
浏览器检测
浏览器方法允许您检测用户的浏览器和版本。
检测到的浏览器
- Vivaldi
- Opera
- Opera Mini
- WebTV
- Internet Explorer
- Pocket Internet Explorer
- Microsoft Edge
- Konqueror
- iCab
- OmniWeb
- Firebird
- Firefox
- Iceweasel
- Shiretoko
- Mozilla
- Amaya
- Lynx
- Safari
- Chrome
- Navigator
- GoogleBot
- Yahoo! Slurp
- W3C Validator
- BlackBerry
- IceCat
- Nokia S60 OSS Browser
- Nokia Browser
- MSN Browser
- MSN Bot
- Netscape Navigator
- Galeon
- NetPositive
- Phoenix
- SeaMonkey
- Yandex Browser
使用方法
/** * Gets the version of the user's browser * @return string */ Identify::browser()->getVersion() /** * Gets the name of the user's browser * @return string */ Identify::browser()->getName()
操作系统检测
os方法允许您检测用户的操作系统和版本。
检测到的操作系统
- Windows
- Windows Phone
- OS X
- iOS
- Android
- Chrome OS
- Linux
- SymbOS
- Nokia
- BlackBerry
- FreeBSD
- OpenBSD
- NetBSD
- OpenSolaris
- SunOS
- OS2
- BeOS
使用方法
/** * Gets the version of the user's Operating System * @return string */ Identify::os()->getVersion() /** * Gets the name of the user's Operating System * @return string */ Identify::os()->getName()
设备检测
device方法允许您检测用户的设备。
检测到的设备
- iPad
- iPhone
- Windows Phone
使用方法
/** * Gets the name of the user's device * @return string */ Identify::device()->getName()
语言检测
language方法允许您检测用户的语言。
使用方法
/** * Gets the language that the user's browser contents are displayed in * @return string */ Identify::lang()->getLanguage()
贡献
请随意分支此包,并通过提交拉取请求来增强功能进行贡献。
我该如何感谢你呢?
为什么不给github仓库加星标呢?我很希望得到关注!为什么不把此仓库的链接分享到Twitter或HackerNews呢?传播一下消息!
别忘了在Twitter上关注我!
谢谢!Prosper Otemuyiwa。
许可证
MIT许可证(MIT)。有关更多信息,请参阅许可证文件。