Sabbir Ahmad
Sabbir Ahmad

Reputation: 31

How to get exact browser name and version in Laravel 5.5?

I have used this $device=$request->header('User-Agent'); But while I dd() the output I get something like this:

Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36

How do I get actual browser details?

Upvotes: 1

Views: 4122

Answers (1)

arafatkn
arafatkn

Reputation: 117

You may use PHP's get_browser() function. http://php.net/manual/en/function.get-browser.php In order for this to work, your browscap configuration setting in php.ini must point to the correct location of the browscap.ini file on your system.

get_browser( $request->header('User-Agent') , true);
// Returns an Array with various browser information

Upvotes: 1

Related Questions