Download the PHP package theriddleofenigma/laravel-model-validation without Composer

On this page you can find all versions of the php package theriddleofenigma/laravel-model-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 laravel-model-validation

Laravel Model Validation

Tests Latest Stable Version Total Downloads License

Effortless, self-contained validation for your Eloquent models.

Keep your validation rules where the data lives. Declare the rules on the model, opt in to the model event you care about, and every save is validated automatically — no form requests, no repeated calls to the validator.

Requirements

Package Version
PHP 8.2, 8.3, 8.4
Laravel 12.x, 13.x

Laravel 13 requires PHP 8.3 or newer. Older Laravel releases that have reached end-of-life are not supported.

Installation

Quick start

Add the Enigma\ValidatorTrait to a model, declare its rules, and register the event you want to validate on:

Now any attempt to save an invalid model throws an Illuminate\Validation\ValidationException, exactly like Laravel's own validation — so in an HTTP context the errors are flashed and redirected for you automatically.

Registering validation

Three helpers register the matching Eloquent event listener for you:

Prefer to validate on a different event, or on demand? Call validate() yourself. It returns the validated data and throws on failure:

Customising the configuration

Rules, messages and attribute names can each be declared either as a property or as a method of the same name. A method always takes precedence, so you can compute the configuration dynamically when you need to.

Controlling the data that gets validated

By default the model's raw attributes are validated. Declare a validationData() method to reshape that data first — the returned value is used only for validation and never changes what is persisted.

Skipping validation

Sometimes you need to persist a model without validating it — a seeder, a data import, or an admin override. There are three ways to do it.

Skip it on a single instance and save:

Toggle the flag back on when you need to:

Disable validation for a whole block — the cleanest way to skip it when creating through the query builder:

Validation is automatically re-enabled once the callback finishes, even if it throws.

Before & after hooks

Implement beforeValidation() and/or afterValidation() to run logic around each validation pass:

Testing

Contributing

Pull requests are welcome! Please read the contributing guide first, make sure the test suite passes, and add coverage for any behaviour you change. Notable changes are tracked in the changelog.

Security

If you discover a security vulnerability, please follow the process in SECURITY.md rather than opening a public issue.

Code of Conduct

This project follows a Code of Conduct. By participating, you are expected to uphold it.

License

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


All versions of laravel-model-validation with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
illuminate/contracts Version ^12.0|^13.0
illuminate/database Version ^12.0|^13.0
illuminate/support Version ^12.0|^13.0
illuminate/validation Version ^12.0|^13.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 theriddleofenigma/laravel-model-validation contains the following files

Loading the files please wait ...