Download the PHP package weew/validator without Composer

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

PHP Validator

Build Status Code Quality Test Coverage Version Licence

Table of contents

Installation

composer require weew/validator

Available constraints

Additional constraint packs

There are additional constraints that you may load trough composer.

Constraints

Constraints are small pieces of validation logic. A constraint can be used on its own, without the validator.

Constraint groups

Constraint groups allows you to configure multiple constraints for a single value.

Constraint groups can be used to validate data without the validator. The method returns a object.

Validator

The easiest way to use the validator is by creating a new instance and adding constraints inline. Validator will return a object.

Validation result and validation errors

Validation result is used to group occurring validation errors. Validation errors hold information about the validated properties, their values and the applied constraints.

Composing a custom validator

You can compose a validator with predefined constraints that will be applied on each validation.

Creating a custom validator class

Configuring validators inline is not always the best solution. Sometimes you might want to create dedicated validator classes. With this library this is very easy to achieve.

Custom constraints

Creating a new constraint is a fairly easy task. All you have to do is to implement the interface. This is an example on how to create a simple constraint that makes sure that a number is within the given range.

Wildcard validation

Imagine you have a similar structure that you want to validate.

In order to validate the name property of every single element inside the items array, you would have to iterate over the items manually. You could also use a wildcard to target all the values. To wildcard array values, you can use this special character *.

In the example above, result will hold an error with subject items.1.name.

Array keys can also be validated using wildcards. You'll have to use a different wildcard character #. Be aware that the # wildcard character should always be the last path segment. This is wrong foo.#.bar, this is ok foo.bar.#.

Result will contain an error with subject #items.1. As you see, there is a # prefix in front of subjects for wildcard keys. This way you can differentiate between subjects for values and subjects for keys.

Property accessors

Validator comes with support for multiple data types.

Array accessor

This accessor adds support for array based data sets.

Object accessor

This accessor adds support for object based data sets.

Getter accessor

This accessor adds support for objects that only allow to access data over getter methods.


All versions of validator with dependencies

PHP Build Version
Package Version
Requires weew/helpers-string Version ^1.0.0
weew/contracts Version ^1.1
weew/helpers-array Version ^1.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 weew/validator contains the following files

Loading the files please wait ....