Validate Formatting of World-Wide Postal Codes according to DHL Country Code and Postcode Formats
use Sirprize\PostalCodeValidator\Validator;
$validator = new Validator();
$validator->hasCountry('CH'); // returns true
use Sirprize\PostalCodeValidator\Validator;
$validator = new Validator();
$validator->isValid('CH', 'usjU87jsdf'); // returns false
$validator->isValid('CH', '3007'); // returns true
use Sirprize\PostalCodeValidator\Validator;
$validator = new Validator();
$validator->getFormats('GB'); // returns array('@@## #@@', '@#@ #@@', '@@# #@@', '@@#@ #@@', '@## #@@', '@# #@@')
#
=0-9
@
=a-zA-Z
Postal-code-validator uses ISO 3166 2-letter country codes
See LICENSE.