Download the PHP package m1x0n/opis-json-schema-error-presenter without Composer

On this page you can find all versions of the php package m1x0n/opis-json-schema-error-presenter. 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 opis-json-schema-error-presenter

opis-json-schema-error-presenter Build Status

Warning

⚠️This library might become obsolote since new major version (2.0.0) of opis/json-schema already supports Error formating.

Customizable error presenter for json schema validation errors produced by opis/json-schema library: JSON schema implementation.

In other words it's a raw attempt to represent Opis\JsonSchema\ValidationError collection in human readable way.

Requirements

Installation

Usage example

Output result example

Presenting Strategies

In order to specify strategy simply pass selected one to PresentedValidationErrorFactory, e.g:

Custom translations

There is a possibility to have custom translations. Currently there is only DefaultTranslator which exposes some generic messages like:

The attribute length should be at least 3 characters

In order to replace or extend or come up with new translations MessageTranslator interface must be implemented. For example:

Locale resolving

For better experience with different localizations custom translator could be used alongside with automatic locale resolution.

Currently next locale resolvers are implemented:

It's also possible to implement custom locale resolver by implementing LocaleResolver interface.

To set up HttpLocaleResolver or custom-crafted one:

Locale support

Currently there is a possibility to use locales defined in php arrays via ArrayLocaleLoader. See lang/en.php.

In order to load more languages ValidationErrorPresenter might be configured in following way:

However it's possible to load locale strings from anywhere by implementing LocaleLoader interface.

Also presenter could be configured with single locale. For doing that FixedLocaleResolver will be helpful. For example:

All the configurations might be slightly simplified by using DI-container.


All versions of opis-json-schema-error-presenter with dependencies

PHP Build Version
Package Version
Requires php Version >=7.1
ext-json Version *
opis/json-schema Version ^1.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 m1x0n/opis-json-schema-error-presenter contains the following files

Loading the files please wait ....