Download the PHP package hasan-22/generate_validation without Composer

On this page you can find all versions of the php package hasan-22/generate_validation. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package generate_validation


Generate validation 📝

A Laravel package to automatically generate validation rules from models.

✨ Features

🚀 Installation

You can install the package via Composer:

📖 Usage

1. Generating a Form Request

For example, we want to generate validation for the Post model.

First, create the migration and model using this command:

This is our Post migration

This is our Post model

And now run this command for generate the validations:

Note: Note: The id column is always excluded from generated validation rules.

Note: This will create a new file at app/Http/Requests/PostRequest.php containing the generated rules.

This is the PostRequest.php file

Note: Please review the created validation once to ensure that nothing is missing or excessive, and fix it if necessary.

2. Using the Form Request

You can now use this Form Request in your controller methods to automatically validate incoming requests.

⚙️ Configuration (Optional)

🎯 Custom Rules via Config

In addition to automatically generating rules based on your model's database schema, you can define custom validation rules for specific models and columns in the configuration file.

This allows you to override the auto-generated rules and fully control the validation logic.

1. Publish the Config File

If you haven't already published the config file, run:

This will create a file at: config/generate_validation.php

2. Define Your Custom Rules

3. How It Works

If a column has a custom rule defined in the config, the package will use that instead of generating the rule automatically.

If a column is not defined in custom_rules, the default auto-generation logic will be applied.

This gives you the flexibility to handle special cases without losing the convenience of automatic generation.


🖼 Blob & File Rules

You can customize the default rules for specific strategies. For example, to change the default max size for images, you can use the static methods of the BlobRuleGenerator class.

In your ServiceProvider's boot method:

💖 Support the Project

If you like this project and want to support its development, you can donate here: Donate via NOWPayments

🤝 Contributing

We welcome contributions! If you find a bug or have a suggestion for a new feature, please open an issue or submit a pull request on GitHub.

📄 License

generate_validation is open-sourced software licensed under the MIT license.



All versions of generate_validation with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package hasan-22/generate_validation contains the following files

Loading the files please wait ...