定制 codepoetry/request-validation 二次开发

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

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

codepoetry/request-validation

最新稳定版本:1.0.5

Composer 安装命令:

composer require codepoetry/request-validation

包简介

REST Payload validation for PHP applications.

README 文档

README

REST Payload Validation for PHP Applications

License

Description

codepoetry/request-validation is a PHP library that provides functionality for validating REST API payloads in PHP applications. It helps you ensure that incoming data adheres to your specified rules and constraints, making your applications more robust and secure.

Installation

You can install this package via Composer:

composer require codepoetry/request-validation

Requirements

  • PHP >= 8.2

Usage

Here's a basic example of how to use this package: Create ExampleRequest.php file in app/Http/Requests

<?php

namespace App\Http\Requests;

use Codepoetry\RequestValidation\RequestAbstract;

class ExampleRequest extends RequestAbstract
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize(): bool
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules(): array
    {
        return [
            "email" => "require"
        ];
    }

    /**
     * Get custom messages for validator errors.
     *
     * @return array
     */
    public function messages(): array
    {
        return [
            "email.unique" => trans('validation.email_unique'),
        ];
    }
}

Documentation

For detailed documentation and examples, please refer to the official documentation.

License

This package is proprietary software. See the LICENSE file for licensing information.

Author

Contributing

Contributions are welcome! Please see our Contribution Guidelines for more details.

Issues

If you discover any issues or have questions, please feel free to open an issue in the issue tracker.

Changelog

See the CHANGELOG.md file for information on recent changes.

Acknowledgments

  • Special thanks to contributors who have helped improve this project.

统计信息

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

GitHub 信息

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

其他信息

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