Download the PHP package crysalead/validator without Composer

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

Validator - Validation library

Build Status Code Coverage

Validator is a flexible and straightforward stand-alone validation library.

Simple Validation Usage

Each validation rule is defined by an array where the first value is the name of the validation handler. Any name can be prefixed by 'not:' to match its opposite requirement. The subsequent keys define additional options and the following are the one shared by all validation handler:

Multi-dimensional Arrays Validation

To validate array the dotted notation can be used like in following:

It's also possible to validate deeply nested data structures using the same dotted syntax:

Built-in Validation Handlers

All validation can be used with the 'not:' prefix, for example 'not:empty' will fail if the value is empty.

Note: only 'not:empty', 'not:inList' and 'not:inRange' have a default error message defined so if you intend tu use the not: prefix on another validation handler, don't forget to use ->messages() to set it.

Adding Custom Validation Rules

While the validator features a number of handy rules, you'll inevitably want to create your own validation rules. This done (at runtime) by calling set() to specify new rule logic.

The simplest form of rule addition is by Regular Expression:

Often, validation rules come in multiple "formats", for example credit cards, which vary by type of card. Defining multiple formats allows you to retain flexibility in how you validate data.

And if you need more than pattern recognition, you can also supply rules as anonymous functions:

Setting Default Validation Messages

Instead of setting 'message' for each rule, you can set a default message for each validation handler using ::messages() like in the following example:

Adding Global Validation Rules

The Validator class is based on the Checker class for performing validations. To add a global validation handler available for all Validator instance, you'll need to add it to the Checker class instead.

Customizing Error Messages

It's sometimes interesting to display some custom data inside error messages. For example some boundaries or a particular label name. To make it work all parameters need to be added to the validation rule like the following:

Globalization

Since there's a lot of different ways to solve globalization, no assumption on how it should be done have been made. Instead you can define your own error message handler to fit your globalization architecture.

Requirement

Requires PHP >= 5.5.

Installation with Composer

The recommended way to install this package is through Composer. Create a composer.json file and run composer install command to install it:

Testing

The spec suite can be runned with:

PS: Composer need to be present on your system.


All versions of validator with dependencies

PHP Build Version
Package Version
Requires php Version >=5.5
crysalead/set Version ~2.0
crysalead/text Version ~2.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 crysalead/validator contains the following files

Loading the files please wait ....