定制 mkakpabla/validation 二次开发

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

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

mkakpabla/validation

Composer 安装命令:

composer require mkakpabla/validation

包简介

A simple form validator in PHP

README 文档

README

Build Status

Zen Validation - PHP Validation Library

Features

  • API like Laravel validation.
  • Array validation.
  • Custom validation messages.

Requirements

  • PHP 7.2 or higher
  • Composer for installation

Quick Start

Installation

composer require "mkakpabla/validation"

Usage

Examples :

<?php

require 'vendor/autoload.php';

use Zen\Validation\Validator;

$validator = new Validator([], [
  'title' => 'required|notEmpty',
  'slug' => 'required|slug',
  'content' => 'required|text'
  ]);

$validator->validate();

if(!$validator->isValid()) {
  var_dump($validator->errors());
} else {
  
  // Formulaire valide
  // Traitements
}

Custom Messages for Validator

<?php

require 'vendor/autoload.php';

use Zen\Validation\Validator;
$validator = new Validator($data, [
  'title'  => 'required',
  ]);
$validator->addErrorsMessages([
  'title.required' => "le titre est obligatoire"
]);
$validator->validate();

Validation Rules

  • required - Field is required
  • email - Field must be email
  • notEmpty - Field did not be empty
  • alpha - Content of field must be alphabetic
  • alphaNum - Content of field must be alphanumeric
  • integer - Must be integer number
  • text - Field must be a text
  • datetime - Field must be a datetime
  • time - Field must be a time
  • date - Field must be a date
  • slug - Field must be a slug
  • confirm - Field must be a same as another field
  • min:number - The field under this rule must have a size biger or equal than the given number
  • max:number - The field under this rule must have a size lower or equal than the given number
  • between:min,max - The field under this rule must have a size between min and max params

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-09-16

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固