Laravel get server ip

2024-04-27 13:06:15 Engres Laravel

How to get the server IP with Laravel?

Use below code to get IP address server in Laravel.

request()->server('SERVER_ADDR');

You can also use old php way to get server ip by $_SERVER['SERVER_ADDR'];

This post is submitted by one of our members. You may submit a new post here.

Related Tricks