PHP code example of phil / address

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

    

phil / address example snippets


use Phil\Address\Address;
use Phil\Address\AddressFormatter;
use Phil\Address\AddressValidator;

$address = Address::of('CA', [
    'addressLine1' => '1234 rue Saint-Denis',
    'locality' => 'Montréal',
    'administrativeArea' => 'Québec',
    'postalCode' => 'H2X 3K8',
]);

AddressValidator::isValid($address);       // true
AddressFormatter::format($address, 'fr');  // "1234 rue Saint-Denis\nMontréal QC H2X 3K8"