Download the PHP package odan/validation without Composer

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

Validation

A validation library for PHP that uses the notification pattern.

Latest Version on Packagist Build Status Coverage Status Quality Score Total Downloads

Table of contents

Requirements

Installation

Usage

A notification is a collection of errors

In order to use a notification, you have to create the ValidationResult object. A ValidationResult can be really simple:

You can now test the ValidationResult and throw an exception if it contains errors.

Validating form data

Login example:

Validating JSON

Validating a JSON request works like validating form data, because in PHP it's just an array from the request object.

In vanilla PHP you can fetch the JSON request as follows:

Regex

The Selective\Validation\Regex\ValidationRegex class allows you to validate if a given string conforms a defined regular expression.

Example usage:

Middleware

The ValidationExceptionMiddleware catches the ValidationException and converts it into a nice JSON response.

Slim 4 integration

Insert a container definition for ValidationExceptionMiddleware::class:

Add the ValidationExceptionMiddleware into your middleware stack:

Usage in Slim

Validators

You can combine this library with a validator that is doing the actual validation of your input data.

The converter pattern makes it easy to map instances of one class into instances of another class.

CakePHP Validator

The cakephp/validation library provides features to build validators that can validate arbitrary arrays of data with ease.

Installation

Usage

The Cake\Validation\Validator::validate() method returns a non-empty array when there are validation failures. The list of errors then can be converted into a ValidationResult using the Selective\Validation\Factory\CakeValidationFactory or Selective\Validation\Converter\CakeValidationConverter.

For example, if you want to validate a login form you could do the following:

Please note: The CakeValidationFactory should be injected via constructor.

Read more: https://odan.github.io/2020/10/18/slim4-cakephp-validation.html

Transformer

If you want to implement a custom response data structure, you can implement a custom transformer against the \Selective\Validation\Transformer\ResultTransformerInterface interface.

Example

License

The MIT License (MIT). Please see License File for more information.


All versions of validation with dependencies

PHP Build Version
Package Version
Requires php Version ^7.2 || ^8.0
ext-json Version *
psr/http-factory Version ^1.0.1
psr/http-server-middleware Version ^1.0.1
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 odan/validation contains the following files

Loading the files please wait ....