rodineiti/php-rdn-validator 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

rodineiti/php-rdn-validator

最新稳定版本:v1.0.2

Composer 安装命令:

composer require rodineiti/php-rdn-validator

包简介

This is a library that uses componser as the basic validations

README 文档

README

This library has the function of validate yours forms. Doing this in an uncomplicated way is essential for any system.

To install the library, run the following command:

composer require rodineiti/php-rdn-validator

To use the library, simply require the composer to autoload, invoke the class and call the method:

<?php

require __DIR__ . '/vendor/autoload.php';

use RdnValidator\Validator\Validator;

if (isset($_POST['submit'])) {
	$rules = [
	    'username' => ['required'],
	    'email' => 'required|email',
            'cpf' => 'required|cpf',
            'cnpj' => ['required','cnpj'],
	];
	
	$messages = [
            'required' => 'This :field is required',
            'email' => 'This email is invalid',
            'cpf' => 'This CPF is inválid',
            'cnpj' => 'This CNPJ is invalid'
        ];

	$validator = (new Validator($_POST, $rules, $messages))->passes();

	$errors = $validator->fails() ? $validator->getErrors() : [];
	
	var_dump($errors);
}

Validations present at the moment:

  • Required
  • Email
  • Cpf
  • Cnpj

Developers

License

MIT

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-12-02