Download the PHP package mszewcz/php-json-schema-validator without Composer
On this page you can find all versions of the php package mszewcz/php-json-schema-validator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package php-json-schema-validator
php-json-schema-validator
JSON schema validator class, which provides validation of JSON files according to draft-06 specification, published on 2017-04-15.
Contents
- Installation
- Usage
- Supported Elements
- Contributing
- License
Installation
If you use Composer to manage the dependencies simply add a dependency on to your project's composer.json file. Here is a minimal example of a composer.json:
You can also clone or download this respository.
php-json-schema-validator meets PSR-4 autoloading standards. If using the Composer please include its autoloader file:
If you cloned or downloaded this repository, you will have to code your own PSR-4 style autoloader implementation.
Usage
If you don't want to use Utils class to decode JSONs, you should do that the following way:
Supported elements
php-json-schema-validator supports validation against:
- additionalItems
- additionalProperties
- allOf
- anyOf
- const
- contains
- dependencies
- enum
- exclusiveMaximum
- exclusiveMinimum
- format (date-time, email, host, ipv4, ipv6 & uri)
- items
- maximum
- minimum
- maxItems
- maxLength
- maxProperties
- minItems
- minLength
- minProperties
- multipleOf
- not
- oneOf
- pattern
- patternProperties
- properties
- propertyNames
- required
- type
- uniqueItems
It also supports $ref
element, so you can use in-json definitions and references without any problems.
Contributing
Contributions are welcome. Please send your contributions through GitHub pull requests
Pull requests for bug fixes must be based on latest stable release from the branch whereas pull requests for new features must be based on the branch.
Due to time constraints, I'm not always able to respond as quickly as I would like. If you feel you're waiting too long for merging your pull request please remind me here.
Coding standards
We follow PSR-2 coding style and PSR-4 autoloading standards. Be sure you're also following them before sending your pull request.
License
php-json-schema-validator is licensed under the MIT License - see the file for details.