Search code examples
laravelrequestclient

what information can i get from the client browser an how can i get that in laravel 7.x


I'm trying to save the most info about a client browser with laravel, actually i know i can access to the ip, the user agent and the request type, there is more information about the client?

use Illuminate\Http\Request;

public function example(Request $request)
{
    $request->ajax();
    $request->pjax();
    $request->ip();
    $request->ips();
    $request->userAgent();
    $request->fingerprint();
}

Solution

  • All the information about the client is in the $_SERVER variable.

    If you want the client browser use : $_SERVER['HTTP_USER_AGENT'].

    You can find all the keys of this dictionary here: https://www.php.net/manual/en/reserved.variables.server.php