Download the PHP package redot/validator without Composer

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

tests

Validation library lets you configure, rather than code, your validation logic.

Installation

Testing

Usage

After registering the rules that you want to use, you can use the validator like this:

Also, you can validate multiple values at once:

Note that multiple validations return an array of failures rather than a Validator instance.

Btw, you can validate values statically:

Registering rules

The validator came without any registered rules by default. You can add them by using the Validator::addRule() method.

Also you can load the default rules by using the Validator::loadDefaultRules() method.

Loading the default rules will register the following rules:

Rule Description Parameters
alpha The value must contain only alphabetic characters. -
between The value must be between the given min and max. min: int, max: int
contains The value must contain all the given values. mixed[]
doesntContain The value must not contain all the given values. mixed[]
each The value must be an array and each item must pass the given rule. callable
email The value must be a valid email address. -
equal The value must be equal to the given value. mixed
date The value must be a valid date. -
max The value must be less than or equal to the given value. int
min The value must be greater than or equal to the given value. int
pattern The value must match the given pattern. string
required The value must be present. -
string The value must be a string. -
number The value must be a number. -
array The value must be an array. -

You can submit a pull request to add a new rule.

Custom rules

If you have a specific rule you want to use, you can create a class that extends Validator\AbstractRule and register it.

Custom messages

If you want to customize the error messages, you can use the Validator::setMessages() method.

Note that you can pass parameters to the message using {x} placeholders where x is the index of the parameter.

That's it. Enjoy 👌!


All versions of validator with dependencies

PHP Build Version
Package Version
Requires php Version >=8.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 redot/validator contains the following files

Loading the files please wait ....