How to get Ip Address in Laravel?

Share Me
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  

Today now in this post i will show you how to get IP address in laravel application. When we are work on laravel application and we need to get the client ip address then we can get easy. We don’t need to use any $_SERVER variable as like as native PHP, but in laravel provide us the Request facade. we can fetch it easy by using following example:

Example
public function ImpressionCount(Request $request)
{
	$input['ip'] = $request->ip();
	print($input);
}

Read Also: PHP – I Can’t get the $_POST Values on Ajax Request

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

About code chef

My name is Shahriar sagor. I'm a developer. I live in Bangladesh and I love to write tutorials and tips that will help to other Developer's. I am a big fan of PHP, Javascript, JQuery, Laravel, Codeigniter, VueJS, AngularJS and Bootstrap from the early stage.

View all posts by code chef →