Download the PHP package sirprize/postal-code-validator without Composer
On this page you can find all versions of the php package sirprize/postal-code-validator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download sirprize/postal-code-validator
More information about sirprize/postal-code-validator
Files in sirprize/postal-code-validator
Download sirprize/postal-code-validator
More information about sirprize/postal-code-validator
Files in sirprize/postal-code-validator
Vendor sirprize
Package postal-code-validator
Short Description Validate Formatting Of World-Wide Postal Codes
License MIT
Homepage https://github.com/sirprize/postal-code-validator
Package postal-code-validator
Short Description Validate Formatting Of World-Wide Postal Codes
License MIT
Homepage https://github.com/sirprize/postal-code-validator
Please rate this library. Is it a good library?
Informations about the package postal-code-validator
Postal-code-validator
Validate Formatting of World-Wide Postal Codes according this "List of postal codes" article on Wikipedia
Installation
composer require sirprize/postal-code-validator
Usage
Check If Country Is Supported
use Sirprize\PostalCodeValidator\Validator;
$validator = new Validator();
$validator->hasCountry('CH'); // returns true
Check If Postal Code Is Properly Formatted
use Sirprize\PostalCodeValidator\Validator;
$validator = new Validator();
$validator->isValid('CH', 'usjU87jsdf'); // returns false
$validator->isValid('CH', '3007'); // returns true
Get The Possible Formats For a Specific Country
use Sirprize\PostalCodeValidator\Validator;
$validator = new Validator();
$validator->getFormats('GB'); // returns ['@@## #@@', '@#@ #@@', '@@# #@@', '@@#@ #@@', '@## #@@', '@# #@@']
Formatting
#
=0-9
@
=a-zA-Z
Country Codes
Postal-code-validator uses ISO 3166 2-letter country codes
License
See LICENSE.
All versions of postal-code-validator with dependencies
PHP Build Version
Package Version
Requires
php Version
^7.2 || ^8.0
The package sirprize/postal-code-validator contains the following files
Loading the files please wait ....