mikoweb / polish-validator-bundle
Symfony bundle with validators for Polish identification numbers: PESEL, NIP, REGON.
v1.1.1
2016-12-14 12:15 UTC
Requires
- php: >=5.3.1
- kiczort/polish-validator: ^1.0
- symfony/framework-bundle: ~2.1|~3.0
- symfony/validator: ^2.1|~3.0
Requires (Dev)
- phpunit/phpunit: 4.8
This package is auto-updated.
Last update: 2024-10-25 07:14:07 UTC
README
This is Symfony2 bundle with validators for Polish identification numbers like: PESEL, NIP, REGON.
Installation
The recommended way to install this library is Composer.
# Install Composer curl -sS https://getcomposer.org/installer | php
Next, run the Composer command to install the latest stable version:
php composer.phar require kiczort/polish-validator-bundle
Add bundle to AppKernel.php
public function registerBundles() { $bundles = array( ... new Kiczort\PolishValidatorBundle\KiczortPolishValidatorBundle(), ... ); return $bundles; }
Documentation
Example of use PeselValidator:
There are PESEL numbers with errors in real word, so in case of this validator checksum checking is only for strict mode. In case of none strict mode it checks length, used chars and correctness of date of birth.
... // src/AppBundle/Entity/Person.php namespace AppBundle\Entity; use KiczortPolishValidatorBundle\Validator\Constraints as KiczortAssert; class Person { /** * @KiczortAssert\Pesel( * message = "The '{{ value }}' is not a valid PESEL number.", * strict = true * ) */ protected $pesel; }
Example of use NipValidator:
... // src/AppBundle/Entity/Person.php namespace AppBundle\Entity; use KiczortPolishValidatorBundle\Validator\Constraints as KiczortAssert; class Person { /** * @KiczortAssert\Nip */ protected $nip; }
Example of use RegonValidator:
... // src/AppBundle/Entity/Company.php namespace AppBundle\Entity; use KiczortPolishValidatorBundle\Validator\Constraints as KiczortAssert; class Company { /** * @KiczortAssert\Regon */ protected $regon; }
Bug tracking
GitHub issues. If you have found bug, please create an issue.
MIT License
License can be found here.