1. Go to this page and download the library: Download mesour/ip-addresses library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
IpAddressNormalizer::normalizeIpV6('2001:db8:800::ff00:42:8329');
// result is: 2001:0db8:0800:0000:0000:ff00:0042:8329
IpAddressNormalizer::compressIpV6('2001:0db8:0800:0000:0000:ff00:0042:8329');
// result is: 2001:db8:800::ff00:42:8329
$ipAddress = IpAddress::create('127.0.0.1');
$ipAddress->isIpV4(); // result is: true
$ipAddress->isIpV6(); // result is: false
$ipAddress->getValue(); // result is: 127.0.0.1
$ipAddress = IpAddress::create('2001:0db8:0800:0000:0000:ff00:0042:8329');
$ipAddress->isIpV4(); // result is: false
$ipAddress->isIpV6(); // result is: true
$ipAddress->getValue(); // result is: 2001:db8:800::ff00:42:8329
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.