Download the PHP package justinrainbow/json-schema without Composer
On this page you can find all versions of the php package justinrainbow/json-schema. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
More information about justinrainbow/json-schema
Files in justinrainbow/json-schema
Informations about the package json-schema
JSON Schema for PHP
A PHP Implementation for validating
JSON Structures against a given
Schema with support for
Schemas of Draft-3 or Draft-4. Features of newer Drafts might not be supported. See Table of All Versions of Everything to get an overview of all existing Drafts.
See json-schema for more details.
For a complete reference see Understanding JSON Schema.
Note: features of Drafts newer than Draft-4 might not be supported!
If you're validating data passed to your application via HTTP, you can cast strings and booleans to the expected types defined by your schema:
A shorthand method is also available:
If your schema contains default values, you can have these automatically applied during validation:
With inline references
A number of flags are available to alter the behavior of the validator. These can be passed as the
third argument to
Validator::validate(), or can be provided as the third argument to
Factory::__construct() if you wish to persist them across multiple
||Validate in 'normal' mode - this is the default|
||Enable fuzzy type checking for associative arrays and objects|
||Convert data types to match the schema where possible|
||Apply type coercion as soon as possible|
||Apply default values from the schema if not set|
||When applying defaults, only set values that are required|
||Throw an exception immediately if validation fails|
||Do not validate "format" constraints|
||Validate the schema as well as the provided document|
Please note that using
CHECK_MODE_APPLY_DEFAULTS will modify your
CHECK_MODE_EARLY_COERCE has no effect unless used in combination with
enabled, the validator will use (and coerce) the first compatible type it encounters, even if the
schema defines another type that matches directly and does not require coercion.