A light and simple library to obtain the server's public IP Address. This library is useful in updating your DNS target server IP Address if you are using a dynamic IP Address in hosting your server.
composer require villaflor/laravel-ip-address
It is very easy to use this library. Here is an example of printing the public IP Address of a server.
use Villaflor\IpAddress\IpAddress;
public function printPublicIpAddress(): void
{
$publicIp = IpAddress::getPublicIp();
echo $publicIp;
}