PHP code example of mikoweb / polish-validator-bundle

1. Go to this page and download the library: Download mikoweb/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/ */

    

mikoweb / 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 KiczortPolishValidatorBundle\Validator\Constraints as KiczortAssert;

class Person
{
    /**
     * @KiczortAssert\Pesel(
     *     message = "The '{{ value }}' is not a valid PESEL number.",
     *     strict = true
     * )
     */
     protected $pesel;
}

...
// src/AppBundle/Entity/Person.php
namespace AppBundle\Entity;

use KiczortPolishValidatorBundle\Validator\Constraints as KiczortAssert;

class Person
{
    /**
     * @KiczortAssert\Nip
     */
     protected $nip;
}

...
// src/AppBundle/Entity/Company.php
namespace AppBundle\Entity;

use KiczortPolishValidatorBundle\Validator\Constraints as KiczortAssert;

class Company
{
    /**
     * @KiczortAssert\Regon
     */
     protected $regon;
}
bash
# Install Composer
curl -sS https://getcomposer.org/installer | php