Download the PHP package dungeonworx/laravel-devicedetector without Composer
On this page you can find all versions of the php package dungeonworx/laravel-devicedetector. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download dungeonworx/laravel-devicedetector
More information about dungeonworx/laravel-devicedetector
Files in dungeonworx/laravel-devicedetector
Package laravel-devicedetector
Short Description Integration with DeviceDetector and Laravel.
License MIT
Homepage https://dungeonworx.org/devicedetector/
Informations about the package laravel-devicedetector
Laravel DeviceDetector Bridge
This package was created out of a need to integrate Piwik's DeviceDetector package into my Laravel application in a specific way. After working on the code in my project, I realized this package would be best suited to be a package and committed publicly for consumption.
The goal of this project is to provide easier access to the DeviceDetector library and also wrap it in an easy to use Laravel Facade to facilitate seamless access in other areas of the code. This library also provides a middleware which provides some additional information in your request payload to modify parts of your application based on the device that is currently connected.
Usage
Facade
If you include the middleware in your requests, you only need to use the Facade's methods, which are documented.
If you do not use the middleware in your request, or you wish to check a different user agent, you will need to pass the
optional user_agent
parameter to the specific method. Please note, this changes the parsed results for all future
requests as well. So if you wish to go back to returning value for the current browser request, you will need to call
DeviceDetector::get($request->userAgent())
once more to reset back to the current browsing session.
Middleware
To use this package in your middleware, just add the device_detector
middleware alias to your web
middleware in the
Http/Kernel.php
file in your project. Once that's installed, you can access the four included detectors in your
request. The is
key in the request contains an array with four booleans; bot
, desktop
, mobile
, and touch
. These
booleans are available for every request and also cached to your already assigned cache repository.
Documentation
This package is documented using phpDocumentor and it's API documentation can be located here.
All versions of laravel-devicedetector with dependencies
illuminate/support Version ^5.7
illuminate/contracts Version ^5.7
illuminate/http Version ^5.7