shlogg · Early preview
Paul Redmond @paulredmond

Get Your Server's Public IP With KnotsPHP PublicIP Library

PublicIP is a PHP library that gets your server's public IP address quickly and reliably. Use it to get IPv4 or IPv6, with options for custom DNS providers and fetchers. Install via Composer: `composer require knotsphp/publicip

PublicIP is a PHP library that gets a server's public IP address reliably and quickly. This package has an opinionated default configuration to give you the fastest and most reliable providers. However, you can configure and use different providers:
use KnotsPHP\PublicIP\Finders\PublicIP;use KnotsPHP\PublicIP\Finders\PublicIPv4;use KnotsPHP\PublicIP\Finders\PublicIPv6; $ipv4 = PublicIPv4::get(); // returns your IPv4$ipv6 = PublicIPv6::get(); // returns your IPv6$ipv4or6 = PublicIP::get(); // returns either IPv4 or IPv6
This package provides two basic methods for getting the server's IP, includ...