PHP code example of nonsapiens / realaddressfactory
1. Go to this page and download the library: Download nonsapiens/realaddressfactory 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/ */
$address = $faker->realAddress('Brazil') # From any of the defined cities
$address = $faker->realAddress('Brazil', 'Rio de Janiero'); # For Rio de Janiero only
$address = $faker->realAddresss('Brazil', ['Rio de Janiero', 'Salvador']) # Multiple cities
use Nonsapiens\RealAddressFactory\RealAddressFactory;
.
.
.
$johannesburgAddresses = RealAddress::makeSouthAfrica(20, 'Johannesburg'); # 20 addresses for Johannesburg, South Africa
$frenchAddress = RealAddress::makeFrance(1); # A single address for France
$brazilAddresses = RealAddress::make(10, 'Brazil'); # 10 addresses for the custom country of Brazil
use Nonsapiens\RealAddressFactory\RealAddressFactory;
$f = new RealAddressFactory();
$southAfricanPoints = $f->makeSouthAfrica(4); # Generates 4 locations within South Africa's major cities
$capeTownPoints = $f->makeSouthAfrica(2, 'Cape Town'); # Generates 2 locations from Cape Town, South Africa
$multiPoints = $f->makeSouthAfrica(3, ['Pretoria', 'Johannesburg']);