Download the PHP package elie29/validator without Composer

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

Build Status Coverage Status

Introduction

A library for validating a context (POST, GET etc...) by running given rules.

Installation

Run the command below to install via Composer:

Getting Started

Validator requires one or several rules (constraints) in order to validate a given context.

A basic example with \$_POST

Available rules

  1. All Rules accept required, trim and messages options. required is false by default while trim is true.
  2. ArrayRule accepts min and max options. Empty value is cast to empty array [].
  3. BicRule
  4. BooleanRule accepts cast option.
  5. CallableRule accepts callable function.
  6. ChoicesRule accepts list option.
  7. CollectionRule accepts list and json options.
  8. CompareRule accepts sign and expected options. sign is CompareRule::EQ by default, expected is null by default.
  9. DateRule accepts format and separator options.
  10. EmailRule
  11. IpRule accepts flag option.
  12. JsonRule accepts decode option
  13. MatchRule requires pattern option.
  14. MultipleAndRule requires rules option.
  15. MultipleOrRule requires rules option.
  16. NumericRule accepts min, max and cast options.
  17. RangeRule accepts range option.
  18. StringRule accepts min and max options.
  19. TimeRule
  20. Your own rule

How to add a new rule

You need to implement RuleInterface or to extend AbstractRule

Validated Context

Once validate is called, we can use validatedContext method in order to retrieve all validated values from the original context.

By default, all keys set in the rules array will be found in the validatedContext array. However, if we don't want to append non existing keys, we should call appendExistingItemsOnly(true) before validation.

Assertion Integration

Instead of using assertion key by key, you can validate the whole context and than use Assertion or Assert as follow:

Partial Validation

Sometimes we need to validate the context partially, whenever we have a Json item or keys that depend on each others.

The following is an example when a context - eg. \$_POST - should contains a Json user data:

Partial Validation with a multidimensional array

Usually with JsonRule, we could expect a multidimensional array. In this case, the validation process will be similar to Partial Validation without merging data:

A new CollectionRule has been added in order to validate a collection data (array or json) as follow:

Development Prerequisites

Text file encoding

Code style formatter

Composer commands


All versions of validator with dependencies

PHP Build Version
Package Version
Requires php Version ^7.1
ext-json Version *
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 elie29/validator contains the following files

Loading the files please wait ....