Download the PHP package matrozov/yii2-nested-field-validation without Composer

On this page you can find all versions of the php package matrozov/yii2-nested-field-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 yii2-nested-field-validation

Yii2 Nested Field Validation

[Русский]

A set of validators for verifying data transferred in nested fields. Validators allow you to check data using standard Yii2 validators for both a nested object and an array of nested objects. Validators can visualize errors in the classic Yii2 format, in a form visually compatible with json, and in a format compatible with the Yii2 Multiple Field Widget plugin.

You can easily verify the specified nested array of objects like this:

Nested validation allows unlimited nesting, as well as all the usual validators, including file validation.

Installation

or add

to the "require" section of your composer.json file.

Usage

We provide validators for all occasions. You can validate both a nested model, an array of nested models, and the keys of such an array.

All validators have the ability to specify the format of the errors returned. The following two error formats are available:

Validator::ERROR_FORMAT_URL - the format used by default. Compatible with the Yii2 Multiple Field plugin for visualizing errors in View. Nested fields with errors are formed as elements in square brackets:

Validator::ERROR_FORMAT_DOT - field generation format that uses a dot "." as a separator:

Typically used to visualize errors at the API level.


The error format can be set globally:

and locally, at the level of any validator, for example:

Validation concept

The validation mechanism offers two solutions for validation. Both by explicitly specifying the validation rules within the rules of the underlying model:

and in the form of placing the rules in a separate model:

Taking the rules into a separate model allows you to decompose the processing of nested entities by taking them out of the main model. Data loading and validation in the nested model occurs in the classic Yii2 way by using the load() and validate() methods. That is, you can use the usual methods of processing and validating data in the nested model. Errors in the nested model will be automatically forwarded and converted according to the format in the main model.

Validator options

ArrayValidator & ModelValidator

A group of validators designed to validate a nested object.

The validator offers the following set of properties:

The validator offers the following set of properties:

KeyValidator

Validator for verifying array keys. It does not validate the elements themselves, but only their keys. Quantity and sequence. When specifying key validation rules, the syntax is similar to the standard EachValidator validator from the Yii2 package: the validation rule does not list the fields to which the validation rule is applied, but the validator itself is specified immediately. Unlike the standard EachValidator, KeyValidator allows specifying a group of validation rules at once.

he validator offers the following set of properties:

KeyValueValidator

Validator for verifying nested array properties. It inherits from KeyValidator and can validate both keys and values ​​at once.

The validator offers the following set of properties:

When specifying validation rules, the syntax used is similar to the standard EachValidator validator from the Yii2 package: the validation rule does not list the fields to which the validation rule applies, but the validator itself is specified immediately. Unlike the standard EachValidator, KeyValueValidator allows for a group of validation rules to be specified at once.

KeyArrayValidator & KeyModelValidator

A group of validators designed to validate a nested array of objects. It also inherits KeyValidator. The validation mechanism of these validators is a combination of the mechanisms of such validator classes as KeyValidator and ArrayValidator/ModelValidator for validating models nested in an array.

The validator properties are identical to the KeyValidator and ArrayValidator properties.

The properties of the validator are identical to the properties of KeyValidator and ModelValidator.

License

yii2-nested-field-validation is released under the MIT License. See the bundled LICENSE for details.


All versions of yii2-nested-field-validation with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4.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 matrozov/yii2-nested-field-validation contains the following files

Loading the files please wait ....