Download the PHP package i-am-tom/schemer without Composer

On this page you can find all versions of the php package i-am-tom/schemer. 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 schemer

Schemer Build Status

Schemer is a Joi-inspired library for validating and formatting data structures. Complex structures' validators can be constructed by composition.

Quickstart

The full API can be accessed via the Schemer\Validator and Schemer\Formatter sets of static functions. We'll bring them in with an alias:

Now, we'll declare a validator and a formatter:

We've used the Assoc validator and formatter to create more complicated validators that nest data. The Collection interfaces can do similar things for sequential arrays. So, let's look at the formatter:

We see that age is now an integer, and the friends key has been created with an empty array, as per the formatting instructions. When handling data from other sources, you'll probably want to attempt to format the data before validating it.

Validation comes in two flavours. First, we'll start with simple validation:

This flattens all the errors down to one Result whose errors method will return them in an array. While this may be suitable for validation of API requests, for example, it's often helpful for the structure of the errors to mimic the structure of the data. This can be achieved using nestedValidate:

Although the above represents the result as an array, it is actually an instance of Schemer\NestedResult, which implements both ArrayAccess and Traversable, which allows you to use foreach syntax as well as array access to get at the results (e.g. $output['age']->errors() === ['missing key']). If there's a nestable (Assoc or Collection) within your structure, nestedValidate will recurse down through these in the same pattern, too!

Well, that's all there is to it! The API will fill in the rest of the blanks.

API

All methods are immutable. Calling a method will return a new object, and not change the previous one in any way:

Schemer\Formatter

Schemer\Validator

Many of these methods accept an optional custom $error string, which overrides the default error.

Contributing

Get involved! PRs are cool.


All versions of schemer 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 i-am-tom/schemer contains the following files

Loading the files please wait ....