定制 ajd/ajd-validation-respect-adapter 二次开发

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

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

ajd/ajd-validation-respect-adapter

Composer 安装命令:

composer require ajd/ajd-validation-respect-adapter

包简介

AJD validation respect validation rules adpater

README 文档

README

Respect Validation adapter for AJD validation

Description

Respect Validation adapter for AJD validation so that you could use repect validation's rules with the unique features that ajd validation provides.

Getting Started

Installing

  • composer require ajd/ajd-validation-respect-adapter

  • after installing add the package to AJD validation as shown by the example below

use AJD_validation\AJD_validation;

$v->addPackages([
	AjdRespect\AjdRespectServiceProvider::class
]);
  • adding package is usally done in the bootsraping of your application

Documentation

API

  • After installing and adding the package you now have access to respect validation rules
  • To access respect validation rules prefix the respect validation rule with respect[respect_rule_name]
use AJD_validation\AJD_validation;

$v = new AJD_validation;

$v
	->respectnotempty()
	->respectalnum('*')
	->check('respectrules', '');
// outputs error 
	/*
		All of the required rules must pass for "Respectrules".
		  - Respectrules must not be empty
		  - Respectrules must contain only letters (a-z), digits (0-9) and "*"
	*/

$v
	->getValidator()
	->respectnotempty()
	->respectalnum('*')
	->validate(''); // returns false

$v
	->respectnotempty()
	->respectalnum('*')
	->check('respectrules', 'a'); // validation passes

$v
	->getValidator()
	->respectnotempty()
	->respectalnum('*')
	->validate('a'); // returns true
  • if you are going to use special rules of respect validation which requries Respect's \Respect\Validation\Validatable as a satisfier/argument
    1. Use $v->getRespectValidator() (this method comes with the package) method which returns \Respect\Validation\Validator instance.
    2. Then enclosed all the \Respect\Validation\Validatable in an array.
    3. When using $v->getRespectValidator() you must call respect validation rules like as discussed here:
      Respect validation documentation
use AJD_validation\AJD_validation;

$v = new AJD_validation;

$v
	->respectnoneof(
		[
			$v->getRespectValidator()
				->NotEmpty()
				->alnum('*')
		]
	)
	->check('respectrules', 'a');
// outputs error 
	/*
		All of the required rules must pass for "Respectrules".
  			- None of these rules must pass for Respectrules
	*/

$v
	->getValidator()
	->respectnoneof(
		[
			$v->getRespectValidator()
				->NotEmpty()
				->alnum('*')
		]
	)
	->validate('a'); // returns false

$v
	->respectnoneof(
		[
			$v->getRespectValidator()
				->NotEmpty()
				->alnum('*')
		]
	)
	->check('respectrules', ''); // validation passes

$v
	->getValidator()
	->respectnoneof(
		[
			$v->getRespectValidator()
				->NotEmpty()
				->alnum('*')
		]
	)
	->validate(''); // returns true

See respect validation documentation here - Respect validation documentation

Authors

Contributors names and contact info Aj Doc (thedoctorisin17@gmail.com)

Version History

  • 0.1 (master)
    • Initial Release

Links

Acknowledgments

Inspiration, code snippets, etc.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-09-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固