承接 ggbear/validation 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

ggbear/validation

Composer 安装命令:

composer require ggbear/validation

包简介

Standalone library to use Illuminate\Validation package outside the Laravel framework.

README 文档

README

Standalone library to use Illuminate\Validation package outside the Laravel framework.

Install Validation:

  • execute
composer require ggbear/validation

Usage

require_once __DIR__ . '\..\vendor\autoload.php';
/** @var Factory $validatorFactory */
$validatorFactory = new ValidatorFactory();

$number = '123456789012a';
$id = 123;
$string = 'string value';
$channel = 'UNKNOWN';

$input = [
    'number' => $number,
    'id' => $id,
    'string' => $string,
    'channel' => $channel
];
$rules = [
    'number' => 'required|integer|digits_between:11,12',
    'id' => 'required|integer',
    'string' => 'required|string',
    'channel' => 'required|string|in:WEB,API,SOCKET',
];
$validator = $validatorFactory->make($input, $rules);

This will return an instance of Illuminate\Validation\Validator::class.



if ($validator->fails()) {
    print_r($validator->errors()->toArray());
} else {
    echo 'Validaton passed.' . PHP_EOL;
}

You can learn more about the Laravel Validator in the official documentation website.

About validation rules

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-07-25

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固