Download the PHP package mortimer333/validate without Composer

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

Validate

Validates your data from predefined schema or by single method

Installation

Installation method is via composer and its packagist package validat/validat.

How to use

Method

All functions are static so you could call them anywhere, anytime. If you wanna check if your array is associative Vali::Assoc( array( 'a' => 'b' ) ), if you want to assign name to validation for clearer errors Vali::Assoc( array( 'a' => 'b' ), 'My assoc array' ), if you wanna check if it's not associative array Vali::Assoc( array( 'a' => 'b' ), 'My assoc array', true ) or just !Vali::Assoc( array( 'a' => 'b' ), 'My assoc array' ). All function and their usage is explained below but you get the idea.

Schema

Schema is predefined structure of data you want to validate. It helps if you recive multiple, nested variables in your API and don't wanna create hundreds of ifs to validate them.

Structure is divided into set and free variables. The set is validated first then all left values with free. You can assign them names (for geting clearer errors) and types. Available types :

It's possible to check if data isn't something. Just add ! before type and it will revert it. Example: [..] 'desc' => ['name' => 'Description', 'types' => ['!js','!php']] [..]. Now it will return false if desc contains any js or php.

If you don't want to use string_empty because all your strings can be empty just change the default setting Vali::$_STRING_EMPTY to true. It will change the behaviour of String function to return true even if string is empty.

And finaly errors: when error occurrs (when variable isn't valid or doesn't exist) apropriate error will be saved into $_LAST_ERROR as a string. To get error you can use Vali::GetError().

Dynamic type assign

What's cool is that you can change the validated type of variable by sending diffrent data and using keyword this. The script will look out in current scope for indicated data and use it contents as types. Example :

FUNCTIONS

Legend:

Usage


All versions of validate with dependencies

PHP Build Version
Package Version
No informations.
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 mortimer333/validate contains the following files

Loading the files please wait ....