Download the PHP package illuminatech/validation-composite without Composer

On this page you can find all versions of the php package illuminatech/validation-composite. 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 validation-composite

Laravel Composite Validation


This extension allows uniting several Laravel validation rules into a single one for easy re-usage.

For license information check the LICENSE-file.

Latest Stable Version Total Downloads Build Status

Installation

The preferred way to install this extension is through composer.

Either run

or add

to the require section of your composer.json.

Usage

The same sequence of the validation rules may repeat over the application many times. For example: you may have a set of restrictions related to the user's password, like it should be at least 8 symbols long, but shorter then 200 to fit the database field reserved for its storage. Your program may also allow user to upload an image to be his avatar, but in order to make it safe, you should validate uploaded file mime type and size. Thus validation for the user profile form may looks like following:

The problem is: validation for user's password or avatar may appear in several different places. For example: password can be setup at sign-up process, during password reset and so on. You may also have a separated administration panel, which allows system administrator to adjust existing user's record or create a new one. Thus you will have to duplicate all these validation rules many times throughout your project source code. In case requirements change, for example: we decide that password length should be at least 10 symbols instead of 8, or disallow '*.png' files from avatar - you'll have to manually changes validation rules at all those places.

This extension allows uniting several validation rules into a single one for easy re-usage. For the example above you should create 2 separated validation rule classes extending Illuminatech\Validation\Composite\CompositeRule:

Here method rules() defines list of validation rules, which will be applied by defined rule internally. Now we can rewrite the form validation in following way:

With such approach you can change validation for the 'password' and 'avatar' at the single place.

In case composite validation rule fails, validator instance will pick up an error message from the particular sub-rule. For example:

Note: do not use rules like 'sometimes', 'required', 'required_with', 'required_without' and so on in the composite rule. These are processed at the different validation level and thus will have no effect or may behave unexpectedly.

You may define composite validation rules using validation factory extensions feature. For such case you may use Illuminatech\Validation\Composite\DynamicCompositeRule. For example:

Note that with such approach automatic pick up of the validation error message becomes impossible, and you will have to setup it explicitly in language files.

You may specify custom error messages per each validation rule used in the composite one, overriding messages() method. For example:


All versions of validation-composite with dependencies

PHP Build Version
Package Version
Requires illuminate/support Version ^6.0 || ^7.0 || ^8.0 || ^9.0 || ^10.0 || ^11.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 illuminatech/validation-composite contains the following files

Loading the files please wait ....