ahmetsabri/gaza-validation-generator 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

ahmetsabri/gaza-validation-generator

最新稳定版本:1

Composer 安装命令:

composer require ahmetsabri/gaza-validation-generator

包简介

A Laravel package to generate validation rules for database tables

README 文档

README

Gaza Validation Generator

Gaza Validation Generator is a Laravel package designed to simplify the creation of validation rules for database tables. This package dynamically generates a validation array based on the schema of a specified table, helping you reduce manual effort and improve consistency.

Features

  • Generate validation rules for any database table with a single command.
  • Automatically detects column properties such as nullable, type, and length to create appropriate rules.
  • Supports common validation rules like required, nullable, string, integer, numeric, boolean, date, and more.
  • Provides a clean, readable output in PHP array format.

Installation

To install the package, run:

composer require ahmetsabri/gaza-validation-generator

Usage

Once installed, you can use the provided artisan command to generate validation rules for any table in your database.

Command

php artisan validate-table {tableName}

Replace {tableName} with the name of the table you want to validate.

Example

For a table named users with the following schema:

Column Type Nullable Length Extra
id BIGINT NO - Auto Increment
name VARCHAR NO 255
email VARCHAR YES 255
phone VARCHAR NO 255
note TEXT YES -
created_at TIMESTAMP YES -
updated_at TIMESTAMP YES -

Running the command:

php artisan validate-table users

Will output:

[
    'name' => ['required', 'string', 'max:255'],
    'email' => ['nullable', 'string', 'max:255'],
    'phone' => ['required', 'string', 'max:255'],
    'note' => ['nullable', 'string'],
]

Contributing

Contributions are welcome! Feel free to fork the repository and submit pull requests for improvements.

License

This package is open-source and licensed under the MIT License.

Support

For issues or questions, please open an issue on the GitHub repository or contact the maintainer at ahmedmahfouzjob@gmail.com.

Credits

Developed with ❤️

Let me know if you’d like to refine this further!

统计信息

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

GitHub 信息

  • Stars: 16
  • Watchers: 1
  • Forks: 4
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-12-15