Download the PHP package icanboogie/validate without Composer

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

Validate

Release Build Status Code Quality Code Coverage Packagist

The icanboogie/validate package offers a simple API to validate data.

The following validators are available:

The following example demonstrates how data may be validated:

Validation

A validation is defined using an array of key/value pairs where key is an attribute to validate and key is the rules. Rules may be defined as a string or an array of key/value pairs where key is a validator class, or alias, and value an array of parameters and options. Optionally you may provide a validator provider, if you don't, an instance of BuiltinValidatorProvider is created by default.

A validation is represented by a Validation instance.

Empty values, required attributes

It is important to know that validators are not run on empty values, unless the required validator is used too. The following values are considered empty: null, an empty array, an empty trimmed string; but false and 0 are considered valid values.

The following example demonstrates how required influences validation:

Validating data

The validate() method validates data. It returns a ValidationErrors instance if the validation failed, an empty array otherwise.

Asserting that data is valid

The assert() method may be used to assert that data is valid. Instead of returning a ValidationErrors instance like validate(), the method throws a ValidationFailed exception. The validation errors may be retrieved from the exception using its errors property.

Special validation options

The following validation options may be defined:

Validation context

The validation context is represented by a Context instance and is passed along with the value to validate to the validator. The validator may used the context to retrieve parameters and options, and when required get a complete picture of the ongoing validation.

The following properties are available:

The following example demonstrates how a validator may retrieve its parameters and options from the context, and a value from the value reader:

Validator provider

Validator instances are obtained using a validator provider. By default, an instance of BuiltinValidatorProvider is used, but you can provide your own provider, or better, a provider collection.

The following example demonstrates how to use the builtin provider:

The following example demonstrates how to provide your own sample validator:

The following example demonstrates how to provide validators using a container:

The following example demonstrates how to use a number of providers as a collection:


Requirements

The package requires PHP 5.5 or later.

Installation

The recommended way to install this package is through Composer:

$ composer require icanboogie/validate

Cloning the repository

The package is available on GitHub, its repository can be cloned with the following command line:

$ git clone https://github.com/ICanBoogie/validate.git

Documentation

The package is documented as part of the ICanBoogie framework documentation. You can generate the documentation for the package and its dependencies with the make doc command. The documentation is generated in the build/docs directory. ApiGen is required. The directory can later be cleaned with the make clean command.

Testing

The test suite is ran with the make test command. PHPUnit and Composer need to be globally available to run the suite. The command installs dependencies as required. The make test-coverage command runs test suite and also creates an HTML coverage report in build/coverage. The directory can later be cleaned with the make clean command.

The package is continuously tested by Travis CI.

Build Status Code Coverage

License

icanboogie/validate is licensed under the New BSD License - See the LICENSE file for details.


All versions of validate with dependencies

PHP Build Version
Package Version
Requires php Version >=5.5
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 icanboogie/validate contains the following files

Loading the files please wait ....