定制 kiczort/polish-validator-bundle 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

kiczort/polish-validator-bundle

最新稳定版本:v1.3.1

Composer 安装命令:

composer require kiczort/polish-validator-bundle

包简介

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

README 文档

README

License Version Build status Scrutinizer Quality Score FOSSA Status

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

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 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;
}

Example of use NipValidator:

...
// 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;
}

Example of use RegonValidator:

...
// 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;
}

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
     */
     #[KiczortAssert\Pwz(message:  "This is not a valid PWZ number.")]
     protected $pwz;
}

Bug tracking

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

MIT License

License can be found here.

FOSSA Status

统计信息

  • 总下载量: 22.69k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 12
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 11
  • Watchers: 3
  • Forks: 13
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-07-19