I am trying to get the client\'s IP address in Laravel.
It is easy to get a client\'s IP in PHP by using $_SERVER[\"REMOTE_ADDR\"]. It is working fine
$_SERVER[\"REMOTE_ADDR\"]
If you want client IP and your server is behind aws elb, then user the following code. Tested for laravel 5.3
$elbSubnet = '172.31.0.0/16'; Request::setTrustedProxies([$elbSubnet]); $clientIp = $request->ip();