Download the PHP package harmonyio/validation without Composer

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

Validation

Latest Stable Version Build Status Build status Coverage Status License

Async validation library

Requirements

In addition for non-blocking context one of the following event libraries should be installed:

Installation

Usage

This library is based on the amphp concurrency framework.

Basic usage

Validating a value against a single rule:

This will result in the following Result object:

Stacking validation rules

Validation rules can be stacked on top of each other when you want to apply multiple rules to the same value:

This will result in the following Result object:

Validation rules

There is already an elaborate list of validation rules implemented. For an overview of all supported rules please see the documentation in the wiki.

All validation rules adhere to the same interface:

This will ensure any value can always be passed in to be validated and it will always result in a promise which resolved to a Result object.

If you are missing a validation rule feel free to open an issue.

Combinators

Combinators are a way to combine multiple validation rules into a single result.

This can be used to build more complex validation rules based on existing rules.

Results and errors

All validation always result in a HarmonyIO\Validation\Result\Result object.
To check whether a value is valid after validating we can simply call the HarmonyIO\Validation\Result\Result::isValid() method which returns a simple boolean.

If the validation fails the validation errors can be accessed using one of two methods on the Result object:

Errors

When validation results in an invalid result at least one Error object will be added to the Result object.

An error object always has an error message (which can be used for translation for rendering in your project) and zero or more parameters.
Parameters are used when failed validation rules are based on dynamic values. I.e. when the validation rule for minimum length of text fails it will result in the following Error object:

Traditional / blocking usage

Although this project is based on async programming it is also possible to use it in a more traditional blocking way using the wait() helper function:

Rules

An overview of all implemented rules (including usage and version information) is documented in the wiki.


All versions of validation with dependencies

PHP Build Version
Package Version
Requires php Version ^7.3
ext-ctype Version *
ext-dom Version *
ext-fileinfo Version *
ext-filter Version *
ext-gd Version *
ext-hash Version *
ext-json Version *
ext-libxml Version *
ext-mbstring Version *
amphp/amp Version ^2.1.1
amphp/artax Version ^3.0.14
amphp/dns Version ^0.9.13
amphp/file Version ^0.3.3
amphp/parallel-functions Version ^0.1.3
amphp/process Version ^1.0.2
amphp/uri Version ^0.1.3
egulias/email-validator Version ^2.1.1
harmonyio/cache Version ^1.0.0-rc1
harmonyio/http-client Version ^1.0.0-rc1
myclabs/php-enum Version ^1.6.4
react/promise Version ^2.7.0
wikimedia/ip-set Version ^2.0.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 harmonyio/validation contains the following files

Loading the files please wait ....