PHP code example of mahelbir / ipv6gen

1. Go to this page and download the library: Download mahelbir/ipv6gen 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/ */

    

mahelbir / ipv6gen example snippets


$generator = new \Mahelbir\Ipv6Gen('ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff', 64);
echo $generator->getIP(); # ffff:ffff:ffff:ffff:b7e4:e549:5173:484d


$generator = new \Mahelbir\Ipv6Gen('ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff', 32);
print_r($generator->getIPs(5));
/*
    (
        [0] => ffff:ffff:ecad:7759:29d8:ac05:07b6:56d7
        [1] => ffff:ffff:4f98:df9f:b796:651e:3bff:f71e
        [2] => ffff:ffff:8e6f:b966:9f0c:6650:ba59:9ccf
        [3] => ffff:ffff:2b46:81fb:d078:ad16:06e3:c98e
        [4] => ffff:ffff:cd95:15f0:111e:4c70:dbfd:64ba
    )
 */