Home php How to Get User Agent Value in Laravel?

How to Get User Agent Value in Laravel?

by Shahriar Sagor

Today now in this post i will show you how to get User Agent Value in laravel. If we are work on laravel application and we need to get the user agent(N.B: user agent mean that user browser details as like firefox, cherome etc) then we can get this very easy. We don’t need to use any $_SERVER variable as like native PHP, but in laravel provide us Request facade. We can fetch this very easily by using following example:


public function ImpressionCount(Request $request)
	$impre['useragent'] = $request->server('HTTP_USER_AGENT');
	$input['ip'] = $request->ip();

Read Also : How to convert Object into Array in PHP?

Thanks for read. I hope it help you. For more you can follow us on facebook.


You may also like