Download the PHP package laracraft-tech/laravel-schema-rules without Composer
On this page you can find all versions of the php package laracraft-tech/laravel-schema-rules. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download laracraft-tech/laravel-schema-rules
More information about laracraft-tech/laravel-schema-rules
Files in laracraft-tech/laravel-schema-rules
Package laravel-schema-rules
Short Description Automatically generate Laravel validation rules based on your database table schema!
License MIT
Homepage https://github.com/laracraft-tech/laravel-schema-rules
Informations about the package laravel-schema-rules
Laravel Schema Rules
Automatically generate basic Laravel validation rules based on your database table schema! Use these as a starting point to fine-tune and optimize your validation rules as needed.
Here you can use the web version, if you like: https://validationforlaravel.com
Installation
You can install the package via composer:
Then publish the config file with:
ToC
- Laravel Schema Rules
- Installation
- ToC
- Usage
- Generate rules for a whole table
- Generate rules for specific columns
- Generate Form Request Class
- Always skip columns
- Supported Drivers
- Testing
- Changelog
- Contributing
- Security Vulnerabilities
- Credits
- License
Usage
Let's say you've migrated this fictional table:
Generate rules for a whole table
Now if you run:
php artisan schema:generate-rules persons
You'll get:
As you may have noticed the float-column body_size
, just gets generated to ['required', 'numeric']
.
Proper rules for float
, decimal
and double
, are not yet implemented!
Generate rules for specific columns
You can also explicitly specify the columns:
php artisan schema:generate-rules persons --columns first_name,last_name,email
Which gives you:
Generate Form Request Class
Optionally, you can add a --create-request
or -c
flag,
which will create a form request class with the generated rules for you!
Always skip columns
To always skip columns add it in the config file, under skip_columns
parameter.
Supported Drivers
Currently, the supported database drivers are MySQL
, PostgreSQL
, and SQLite
.
Please note, since each driver supports different data types and range specifications, the validation rules generated by this package may vary depending on the database driver you are using.
Testing
Before running tests, you need to set up a local MySQL database named laravel_schema_rules
and update its username and password in the phpunit.xml.dist
file.
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
- Zacharias Creutznacher
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-schema-rules with dependencies
brick/varexporter Version ^0.3.8 || ^0.5.0
doctrine/dbal Version ^3.6 || ^4.0.2
illuminate/contracts Version ^8.0 || ^9.0 || ^10.0 || ^11.0 || ^12.0
illuminate/database Version ^8.0 || ^9.0 || ^10.0 || ^11.0 || ^12.0
illuminate/support Version ^8.0 || ^9.0 || ^10.0 || ^11.0 || ^12.0
illuminate/testing Version ^8.0 || ^9.0 || ^10.0 || ^11.0 || ^12.0
spatie/laravel-package-tools Version ^1.12 || ^1.14