vasildakov / postcode-validator
Postcode Validator
1.1.2
2016-10-09 19:25 UTC
Requires
- php: >=5.4
Requires (Dev)
- phpunit/php-code-coverage: ^3.0|^4.0
- phpunit/phpunit: ^4.7|^5.0
- satooshi/php-coveralls: ~1.0
- squizlabs/php_codesniffer: ~2.3
Suggests
- vasildakov/postcode: For creating Postcode value object
- vasildakov/postcode-doctrine: For integration postcode with Doctrine ORM
- vasildakov/postcode-parser: For parsing Postcodes
This package is not auto-updated.
Last update: 2024-12-21 21:08:28 UTC
README
Installation
The preferred method of installation is via Packagist and Composer. Run
the following command to install the package and add it as a requirement to
your project's composer.json
:
composer require vasildakov/postcode-validator
Examples
Validate United Kingdom postcodes
<?php $validator = new Postcode\Validator('UK'); var_dump($validator->isValid('EC1V 9LB')); // true var_dump($validator->isValid('ABC1 XYZ')); // false
Validate Netherlands postcodes
<?php $validator = new Postcode\Validator('NL'); var_dump($validator->isValid('1012 JS')); // true var_dump($validator->isValid('1234 JS')); // false
License
Code released under the MIT license