The League of Extraordinary Packages

Our Packages:

Presented by The League of Extraordinary Packages

Getting Started




The validator returns detailed errors for each validation failure. Calling the errors method on the validator will return an array of ValidationError objects. Since the ValidationError objects have a toArray method, if you cast them to arrays they would look like this:

   "keyword"     => "format",
   "message"     => "Value '' does not match the format 'uri'",
   "pointer"     => "/id",
   'value'       => '',
   'context'     => ['value' => '', 'format' => 'uri'],
   "keyword"     => "type",
   "message"     => "Value '2192191' is not a string.",
   "pointer"     => "/name",
   'value'       => 2192191,
   'context'     => ['value' => '"2192191"'],

Error Format


The keyword is a unique identifier for this error type. The keyword is the property name used in the schema. You can view the complete list of keywords here.


The message is a developer friendly explanation of what caused the error.

The message is intended for developers and is not localized. Error messages can be easily localized for your application using the keyword, the context, and the symfony/translation component or a similar library.


The pointer is a JSON Pointer to the attribute that caused the error.


The value that caused the error.


The context array holds any data meant to be interpolated into the error message. For example, the schema {"minimum": 2} and the data 1 would return the context ['value' => '1, min' => 2].

Every value in the array is cast to a string so that it can be safely interpolated.