PHP Laravel : How to get client browser/ Device?

后端 未结 5 614
野趣味
野趣味 2021-01-18 05:22

I\'m building a laravel application where I want to keep track of client browser details such as browser name. How do I do it using Laravel ?

public function         


        
5条回答
  •  孤街浪徒
    2021-01-18 06:01

    With latest version of BrowserDetect package, you can get browser information as below:

    Install using below command:

    composer require hisorange/browser-detect

    Once installed, add dependency in config/app.php file.

    Add below line in providers array.

    hisorange\BrowserDetect\ServiceProvider::class,

    Add below line in alias array.

    'BrowserDetect' => hisorange\BrowserDetect\Facade::class,

    Include package in any class file as below to use:

    use BrowserDetect;

    After this you can access BrowserDetect methods as explained in below package link:

    BrowserDetect package link

提交回复
热议问题