PHP Class IsoCodes\ZipCode

Afficher le fichier Open project: ronanguilloux/isocodes Class Usage Examples

Protected Properties

Свойство Type Description
$patterns $patterns = []; $data = json_decode(file_get_contents('http://i18napis.appspot.com/address/data'), true); $countries = explode('~', $data['countries']); foreach ($countries as $country) { $data = json_decode(file_get_contents('http://i18napis.appspot.com/address/data/'.$country), true); if (isset($data['zip'])) { $patterns[$country] = $data['zip']; } } var_export($patterns);

Méthodes publiques

Méthode Description
getAvailableCountries ( ) : array
validate ( string $zipcode, string $country = null ) : boolean

Method Details

getAvailableCountries() public static méthode

public static getAvailableCountries ( ) : array
Résultat array The available countries code list. ['FR', 'US', 'ZA', ...]

validate() public static méthode

public static validate ( string $zipcode, string $country = null ) : boolean
$zipcode string
$country string
Résultat boolean

Property Details

$patterns protected_oe static_oe property

$patterns = []; $data = json_decode(file_get_contents('http://i18napis.appspot.com/address/data'), true); $countries = explode('~', $data['countries']); foreach ($countries as $country) { $data = json_decode(file_get_contents('http://i18napis.appspot.com/address/data/'.$country), true); if (isset($data['zip'])) { $patterns[$country] = $data['zip']; } } var_export($patterns);
protected static $patterns