Download the PHP package henriqueramos/laravel_json_schema_validator without Composer
On this page you can find all versions of the php package henriqueramos/laravel_json_schema_validator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download henriqueramos/laravel_json_schema_validator
More information about henriqueramos/laravel_json_schema_validator
Files in henriqueramos/laravel_json_schema_validator
Package laravel_json_schema_validator
Short Description Laravel JSON Schema Validator it's a Composer package created to help us to validate JSON Schemas.
License MIT
Homepage https://henriqueramos.eti.br/opensources
Informations about the package laravel_json_schema_validator
JSON Schema Validator for Laravel
JSON Schema Validator for Laravel it is a Composer
package created to validate JSON objects against JSON Schemas as an Illuminate\Validation\Validator
custom rule.
About
This package works only at Laravel versions >= 5.8
. And PHP version >= 7.3
.
We uses the incredible package swaggest/json-schema
as a dependency to make everything works like magic.
Installation
Add the following line to the require
section of composer.json
:
Setup
- Run
php artisan vendor:publish --provider="RamosHenrique\JsonSchemaValidator"
. This will create on yourconfig
folder a file namedjson_schema_validator.php
. - In your
.env
file, add your JSON Schema files storage path with keyJSON_SCHEMA_VALIDATOR_STORAGE_PATH
(i.eJSON_SCHEMA_VALIDATOR_STORAGE_PATH=storage/jsonschemas/
). - Set up your JSON Schema file
What is a JSON Schema
We supported the following schemas:
Here's an example for JSON Schema and a valid payload for him:
Usage
After save the Validation Rule on your FormRequest
extended class.