定制 victorium/yav 二次开发

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

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

victorium/yav

Composer 安装命令:

composer require victorium/yav

包简介

Yet Another Validator for PHP. Simple, Stupid and totally framework independent.

README 文档

README

Introduction

YAV is a very simple, stupid implementation framework agnostic library to validate and sanitize data.

Licence

All source files in YAV are released subject to the terms of the MIT license, as written in the included LICENSE.txt file.

Installation

Composer

YAV can be installed with composer (http://getcomposer.org/).

  1. Install composer:

    $ curl -s https://getcomposer.org/installer | php
    
  2. Require YAV as a dependency using composer:

    $ php composer.phar require victorium/yaqb
    

Getting Started

This is a simple example on getting started with YAV:

<?php

define("PATH_TO_YAV_SRC", dirname(__DIR__));

require PATH_TO_YAV_SRC . "/bootstrap.php";

use Yav\Processor\StrProcessor;

// all error messages are stored into here
$errors = [];

$myName = "\nJohn Doe";

$myName = StrProcessor::init(@$myName)
            ->required()
            ->strip()
            ->satisfies("/\s/")
            ->errorMessages("myName", $errors, [
                "required" => "Please enter your name",
                "satisfies" => "Please enter your full name",
            ])->value();

Features

YAV supports the following features:

String processing

<?php

$data["place"] = StrProcessor::init(@$rawData["place"])
            ->required()
            ->strip()
            ->satisfies("/,/")
            ->errorMessages("place", $errors, [
                "required" => "Please enter the city and country",
                "satisfies" => "Please enter in the format: city,country",
            ])->value();

$data["country_code"] = StrProcessor::init(@$rawData["country_code"])
            ->required()
            ->maxLength(2)
            ->minLength(2)
            ->registerCallback(function (&$data, &$errors) {
                $data = strtoupper($data);
            })->errorMessages("country_code", $errors, [
                "required" => "Please enter the country code",
                "maxLength" => "Country codes are 2 letters",
                "minLength" => "Country codes are 2 letters",
            ])->value();

Integer and float processing

Date and time processing

Email processing

Phone number processing

File processing

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-09-02

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固