PHP code example of kiczort / polish-validator-bundle
1. Go to this page and download the library: Download kiczort/polish-validator-bundle library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
kiczort / polish-validator-bundle example snippets
public function registerBundles()
{
$bundles = array(
...
new Kiczort\PolishValidatorBundle\KiczortPolishValidatorBundle(),
...
);
return $bundles;
}
...
// src/AppBundle/Entity/Person.php
namespace AppBundle\Entity;
use Kiczort\PolishValidatorBundle\Validator\Constraints as KiczortAssert;
class Person
{
/**
* @KiczortAssert\Pesel(
* message = "The '{{ value }}' is not a valid PESEL number.",
* strict = true
* )
*/
#[KiczortAssert\Pesel(message: "The '{{ value }}' is not a valid PESEL number.", strict: true)]
protected $pesel;
}
...
// src/AppBundle/Entity/Person.php
namespace AppBundle\Entity;
use Kiczort\PolishValidatorBundle\Validator\Constraints as KiczortAssert;
class Person
{
/**
* @KiczortAssert\Nip
*/
#[KiczortAssert\Nip(message: "This is not a valid NIP number.")]
protected $nip;
}
...
// src/AppBundle/Entity/Company.php
namespace AppBundle\Entity;
use Kiczort\PolishValidatorBundle\Validator\Constraints as KiczortAssert;
class Company
{
/**
* @KiczortAssert\Regon
*/
#[KiczortAssert\Regon(message: "This is not a valid REGON number.")]
protected $regon;
}
...
// src/AppBundle/Entity/Company.php
namespace AppBundle\Entity;
use Kiczort\PolishValidatorBundle\Validator\Constraints as KiczortAssert;
class Doctor
{
/**
* @KiczortAssert\Pwz
*/
#[KiczortAssert\Pwz(message: "This is not a valid PWZ number.")]
protected $pwz;
}