定制 purpledot/validation-bundle 二次开发

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

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

purpledot/validation-bundle

最新稳定版本:1.0.1

Composer 安装命令:

composer require purpledot/validation-bundle

包简介

.

README 文档

README

Additional validators set for Symfony.

Installation

From the command line run

$ composer require purpledot/validation-bundle

Validators

PolishIdCardNumber

Checks if the value is a valid Polish ID number.

Example usage

use PurpleDot\ValidationBundle\Validator\Constraints as PurpleDotAssert;

// ...

#[PurpleDotAssert\PolishIdCardNumber]
private ?string $idCardNUmber = null;

PolishMobilePhone

Checks if the value is a valid Polish mobile phone number.

Example usage

use PurpleDot\ValidationBundle\Validator\Constraints as PurpleDotAssert;

// ...

#[PurpleDotAssert\PolishMobilePhone]
private ?string $phoneNumber;

PolishTaxNumber

Checks if the value is a valid Polish tax number (NIP).

Parameter Type Default Description
requirePrefix bool false Enable/disable tax number prefix requirement
allowPrefix bool true Enable/Disable ability to provide a tax number prefix

Example usage

use PurpleDot\ValidationBundle\Validator\Constraints as PurpleDotAssert;

// ...

#[PurpleDotAssert\PolishTaxNumber]
private ?string $taxNumber;

$this->taxNumber = 'PL7746249830' // valid
$this->taxNumber = '7746249830' // valid 

Require tax number prefix

use PurpleDot\ValidationBundle\Validator\Constraints as PurpleDotAssert;

// ...

#[PurpleDotAssert\PolishTaxNumber(requirePrefix: true)]
private ?string $taxNumber;

$this->taxNumber = 'PL7746249830' // valid
$this->taxNumber = '7746249830' // invalid 

Disallow tax number prefix

use PurpleDot\ValidationBundle\Validator\Constraints as PurpleDotAssert;

// ...

#[PurpleDotAssert\PolishTaxNumber(allowPrefix: false)]
private ?string $taxNumber;

$this->taxNumber = '7746249830' // valid 
$this->taxNumber = 'PL7746249830' // invalid

Pesel

Checks if the value is a valid PESEL number.

Example usage

use PurpleDot\ValidationBundle\Validator\Constraints as PurpleDotAssert;

// ...

#[PurpleDotAssert\Pesel]
private ?string $pesel = null;

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-02-01