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