PHP code example of oni4i / fake-nz-generator

1. Go to this page and download the library: Download oni4i/fake-nz-generator 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/ */

    

oni4i / fake-nz-generator example snippets


$cityGenerator = new CityGeneratorService();

//output "Ahaura"
$randCity1 = $cityGenerator->rand();

//output "Athol"
$randCity2 = $cityGenerator->rand();

$ipGenerator = new IPGeneratorService();

//output "14.1.32.0"
$firstIP = $ipGenerator->first();

//output "14.1.32.1"
$nextIP = $ipGenerator->next($firstIP);

//output "14.1.32.0"
$prevIP = $ipGenerator->prev($firstIP);

//output "14.1.95.255"
$randIP = $ipGenerator->rand();

$zipGenerator = new ZipGeneratorService();

//output "7550"
$randZipCode = $zipGenerator->rand();

//output "9749"
$randZipCodeByCity = $zipGenerator->randByCity('Athol');