Download the PHP package ride/lib-validation without Composer

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

Ride: Validation Library

Validation library of the PHP Ride framework.

What's In This Library

Filters

The Filter interface is used to pre-process a value to fix input automatically. A filter should return the original value if it can't handle the input type.

Different implementations are available.

AllowCharacterFilter (characters)

Filters all non-allowed characters from a string.

This filter has the following option:

LowerCaseFilter (lower)

Transforms all upper case characters to lower case.

This filter has no options.

ReplaceFilter (replace)

Replaces values in a string.

This filter has the following options:

SafeStringFilter (safeString)

StripTagsFilter (stripTags)

Strips HTML and PHP tags from a string, using PHP's internal strips_tags function

This filter has the following option:

TrimFilter (trim)

Trims the provided value from spaces.

This filter has the following options:

UpperCaseFilter (upper)

Transforms all lower case characters to upper case.

This filter has no options.

Validators

The Validator interface is used to validate a single value.

Different implementations are available.

ClassValidator (class)

Checks if the provided string is a valid class name

This validator has the following options:

This validator generates the following errors:

DsnValidator (dsn)

Checks if the provided string is a valid DSN.

This validator has the following option:

This validator generates the following errors:

EmailValidator (email)

Checks if the provided value is a valid email address.

This validator has the following option:

This validator generates the following errors:

FileExtensionValidator (extension)

Checks if the provided path string has an allowed extension.

This validator has the following options:

This validator generates the following errors:

JsonValidator (json)

Checks if the json string is valid.

This validator has the following options:

This validator generates the following errors:

MinMaxValidator (minmax)

Checks if the provided numeric value is in the provided range.

This validator has the following options:

Note: Minimum and maximum are both optional both at least one of them is required. The values for minimum and maximum are included in the range.

This validator generates the following errors:

NumericValidator (numeric)

Checks if the provided value is a numeric value.

This validator has the following options:

This validator generates the following error:

RegexValidator (regex)

Checks if the provided string matches a regular expression.

This validator has the following options:

This validator generates the following errors:

RequiredValdiator (required)

Checks if a value is provided

This validator has the following option:

This validator generates the following error:

SizeValidator (size)

Checks if the length of the provided string or the size of the provided array.

This validator has the following options:

Note: Minimum and maximum are both optional both at least one of them is required. The values for minimum and maximum are included in the range.

This validator generates the following errors:

UrlValidator (url)

Checks if the provided string is a valid URL.

This validator has the following option:

This validator generates the following errors:

WebsiteValdiator (website)

Checks if the provided string is a valid website. This is the same as the URL validator but limited to http(s)://.

This validator has the following option:

This validator generates the following errors:

Constraints

The Constraint interface is used to validate a data container. A data container can be an array or an object.

Different implementations are available.

GenericConstraint (generic)

The GenericConstraint is a combination of filters and validators which can be applied on specific properties of the data container.

This constraint will trim and require the name and description properties to pass.

OrConstraint (or)

The OrConstraint defines a set of properties for which at least one has to be provided. When constraining, it will add a validation error to all properties when none of them is provided.

This constraint will fail when both firstName and displayName are empty.

EqualsConstraint (equals)

The EqualsConstraint defines a set of properties which have to have the same value. Usefull when asking to repeat a new password.

This constraint will fail when password and repeatPassword are not the same value.

ConditionalConstraint (conditional)

The ConditionalConstraint is a generic constraint which only validates when defined properties contain a specific value. Usefull for properties which are dependant on a type or status.

This constraint will require the url property when the type property is set to "url".

ChainConstraint (chain)

The ChainConstraint is used to combine different constraints together into one. Usefull to build a full validation for a complex data type.

This constrain will trim and require the name and description property. The type property is also required. When the value for the type property is "url", the url property is required after being trimmed. The same for the node property when the value of the type property is "node".

ValidationFactory

The ValidationFactory is used to construct new validation instances from this library. You can use is to create filters, validators and constraints on a name basis.

ValidationError

A ValidationError is an error of a single validator. Validators will keep the errors of the last validate call. Constraints will gather the occured errors and collect them in a ValidationException.

ValidationException

A ValidationException is thrown by the constraint implementations after validation is done. It contains all the occured errors which can be obtained in their entirety or only for specific properties.

Code Sample

Implementations

For more examples, you can check the following implementation of this library:

Installation

You can use Composer to install this library.


All versions of lib-validation with dependencies

PHP Build Version
Package Version
Requires ride/lib-reflection Version ^1.0.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 ride/lib-validation contains the following files

Loading the files please wait ....