定制 xaamin/lumen-validation 二次开发

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

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

xaamin/lumen-validation

最新稳定版本:v1.0

Composer 安装命令:

composer require xaamin/lumen-validation

包简介

README 文档

README

Build Status Total Downloads Latest Stable Version License

Introduction

Lumen Validation provides request validation like Laravel does using Form Requests.

Installation

This package requires requires php >= 8.0 and lumen >= 9

Step 1 - Install the package on your project

composer require xaamin/lumen-validation

Step 2 - Add the service provider in bootstrap/app.php

$app->register(
    Lumen\Validation\ValidationServiceProvider::class
);

Step 3 - Extend your request from Lumen\Validation\BaseRequest and injecting it into your controllers automatically will perform the validations. Use the authorize method to determine if the user could access the current request.

use Lumen\Validation\BaseRequest;

class CreateUserRequest extends BaseRequest
{
    protected function authorize()
    {
        return true;
    }

    protected function rules(): array
    {
        return  [
            'email' => ['required', 'string', 'unique:users'],
            'name' => ['required', 'string', 'max: 200'],
        ];
    }
}

License

Lumen Validation is open-sourced software licensed under the MIT license.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-04-14