luizjr / identify
Laravel 6 包提供者,用于识别/检测用户的浏览器、设备、操作系统和语言
1.3.4
2019-09-14 01:55 UTC
Requires
- php: >=5.5.9
- illuminate/support: ^5.0|^6.0
- sinergi/browser-detector: 6.*
README
Laravel 6 包,用于识别用户的浏览器、操作系统、语言和设备,由 consoletvs/identify 分支而来
注意:支持最新的 Laravel 版本
安装
PHP 5.4+ 或 HHVM 3.3+,以及 Composer 是必需的。
要获取 Laravel Identify 的最新版本,只需将以下行添加到您的 composer.json 文件的 require 块中。
composer require luizjr/identify
然后,您需要运行 composer install 或 composer update 来下载它并更新自动加载器。
一旦 Laravel Identify 安装完成,您需要注册服务提供者。打开 config/app.php 并将以下内容添加到 providers 键中。
LuizJr\Identify\IdentifyServiceProvider::class
同时,按照如下方式注册 Facade
'aliases' => [ ... 'Identify' => LuizJr\Identify\Facades\IdentityFacade::class, ... ]
配置
要开始使用,您需要发布所有供应商资产
$ php artisan vendor:publish --provider="LuizJr\Identify\IdentifyServiceProvider"
浏览器检测
browser 方法允许您检测用户的浏览器和版本。
检测到的浏览器
- 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()
贡献
请随意fork此包,并通过提交拉取请求来增强其功能进行贡献。
如何感谢您?
为什么不给github仓库点个赞呢?我很期待关注!为什么不分享此仓库的链接到Twitter或HackerNews呢?传播一下消息吧!
别忘了在twitter上关注我!
谢谢!Luiz Jr.
许可
MIT 许可证(MIT)。请参阅 许可文件 以获取更多信息。