New:Introducing Socket Scanning for VS Code Marketplace Extensions.Learn more →
Get Started

adamaru/polish-validator-bundle

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

adamaru/polish-validator-bundle

Symfony bundle with validators for Polish identification numbers: PESEL, NIP, REGON, PWZ.

Source
Packagist
This package is abandoned and is no longer maintained.
The author recommends using true instead.
This version has been yanked by its maintainers and should not be used.
Version
1.2.0
Version published
Total downloads
6.2K
Maintainers
1
Created
Source

Symfony 3/4 bundle with Polish validators

License Version

This is Symfony 3/4 bundle with validators for Polish identification numbers like: PESEL, NIP, REGON and PWZ.

Installation

composer require adamaru/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 Kiczort\PolishValidatorBundle\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 Kiczort\PolishValidatorBundle\Validator\Constraints as KiczortAssert;

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

Example of use RegonValidator:

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

use Kiczort\PolishValidatorBundle\Validator\Constraints as KiczortAssert;

class Company
{
    /**
     * @KiczortAssert\Regon
     */
     protected $regon;
}

Example of use PwzValidator:

PWZ means "licence to practise a profession" (pl. "prawo wykonywania zawodu"), number given to doctors from NIL (polish Chamber of Physicians and Dentists). Validator accepts also empty strings and nulls so you have to add "Assert/NotBlank" myself.

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

use Kiczort\PolishValidatorBundle\Validator\Constraints  as KiczortAssert;

class Doctor
{
    /**
     * @KiczortAssert\Pwz
     */
     protected $pwz;
}

Bug tracking

GitHub issues. If you have found bug, please create an issue.

MIT License

License can be found here.

Keywords

validator

FAQs

Package last updated on 08 Feb 2019

Related posts