PHP code example of torann / address-format

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

    

torann / address-format example snippets


$address = \Torann\AddressFormat\Address::format([
    'recipient' => 'Jane Doe',
    'organization' => 'Whitworth Institute Inc.',
    'street_address' => '20341 Whitworth Institute',
    'street_address_2' => '405 N. Whitworth',
    'locality' => 'Seattle',
    'admin_area' => 'WA',
    'postal_code' => '98052',
    'country_iso' => 'US',
]);

\Torann\AddressFormat\Address::setFormats([
    'GB' => '%N%n%O%n%A%n%C%n%Z %R',
    'US' => '%N%n%O%n%A%n%C, %S %Z %R',
]);