PHP code example of osmsupport / address-formatter
1. Go to this page and download the library: Download osmsupport/address-formatter 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/ */
osmsupport / address-formatter example snippets
use PredictHQ\AddressFormatter\Address;
$a = new Address();
$a->setCity('Wellington')
->setCountry('New Zealand')
->setCountryCode('NZ')
->setCounty('Wellington City')
->setHouseNumber(53)
->setPostcode(6011)
->setRoad('Pirie Street')
->setState('Wellington')
->setSuburb('Mount Victoria');
$text = $a->format();
/**
* Will display as:
*
* 53 Pirie Street
* Mount Victoria
* Wellington 6011
* New Zealand
*/
echo $text;
use PredictHQ\AddressFormatter\Formatter;
$address = [
'city' => 'Wellington',
'country' => 'New Zealand',
'country_code' => 'NZ',
'county' => 'Wellington City',
'house_number' => 53,
'postcode' => 6011,
'road' => 'Pirie Street',
'state' => 'Wellington',
'suburb' => 'Mount Victoria',
];
/**
* Will display as:
*
* 53 Pirie Street
* Mount Victoria
* Wellington 6011
* New Zealand
*/
$f = new Formatter();
$actual = $f->formatArray($address);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.