laravel-identify
, (*1)
Laravel 5 Package to identify a User's Browser, Operating System, Language and Device, (*2)
Installation
PHP 7.1+ or HHVM 3.3+, and Composer are required., (*3)
To get the latest version of Laravel Identify, simply add the following line to the require block of your composer.json
file., (*4)
"unicodeveloper/laravel-identify": "1.7.*"
You'll then need to run composer install
or composer update
to download it and have the autoloader updated., (*5)
- If you're on Laravel 5.5 or above, that's all you need to do! Check out the usage examples below.
-
If you're on Laravel < 5.5, you'll need to register the service provider once the package is installed. Open up config/app.php
and add the following to the providers
array:, (*6)
-
Unicodeveloper\Identify\IdentifyServiceProvider::class
, (*7)
Also, register the Facade like so:, (*8)
'aliases' => [
...
'Identify' => Unicodeveloper\Identify\Facades\IdentifyFacade::class,
...
]
Configuration
To get started, you'll need to publish all vendor assets:, (*9)
$ php artisan vendor:publish --provider="Unicodeveloper\Identify\IdentifyServiceProvider"
Browser Detection
The browser method allows you to detect a user's browser and version., (*10)
Browsers Detected
- 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
Usage
/**
* 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 Detection
The os method allows you to detect a user's operating system and version., (*11)
OS Detected
- Windows
- Windows Phone
- OS X
- iOS
- Android
- Chrome OS
- Linux
- SymbOS
- Nokia
- BlackBerry
- FreeBSD
- OpenBSD
- NetBSD
- OpenSolaris
- SunOS
- OS2
- BeOS
Usage
/**
* 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 Detection
The device method allows you to detect a user's device., (*12)
Device Detected
- iPad
- iPhone
- Windows Phone
Usage
/**
* Gets the name of the user's device
* @return string
*/
Identify::device()->getName()
Language Detection
The language method allows you to detect a user's language., (*13)
Usage
/**
* Gets the language that the user's browser contents are displayed in
* @return string
*/
Identify::lang()->getLanguage()
Contributing
Please feel free to fork this package and contribute by submitting a pull request to enhance the functionalities., (*14)
How can I thank you?
Why not star the github repo? I'd love the attention! Why not share the link for this repository on Twitter or HackerNews? Spread the word!, (*15)
Don't forget to follow me on twitter!, (*16)
Thanks!
Prosper Otemuyiwa., (*17)
License
The MIT License (MIT). Please see License File for more information., (*18)