How to get client ip address in laravel ?

In this article, We’ll see how we can get the client ip address in laravel.




Simply, We can use the Request object. Just call its ip() method.

Below an example:

 public function index(Request $request) {
   $ip_address = $request->ip(); // return client ip
 }

That’s it!. Please share your thoughts or suggestions in the comments below.

Leave a Reply

Your email address will not be published. Required fields are marked *