Looking to hire Laravel developers? Try LaraJobs

laravel-json-schema maintained by dutchcodingcompany

Description
Adds a service provider for json schemas
Author
Last update
2025/08/14 15:26 (dev-master)
License
Downloads
1 462

Comments
comments powered by Disqus

Json Schema

Latest Version on Packagist Total Downloads

This package makes it easy to use swaggest/json-schema in laravel.

Installation

You can install the package via composer:

composer require dutchcodingcompany/laravel-json-schema

Usage

  1. Create a json schema in the schema directory, eg. storage/app/schema/example.json
  2. Reference the schema in the validator using one of the rules:
    • new \DutchCodingCompany\LaravelJsonSchema\Rules\JsonSchemaRule('example')
    • new \DutchCodingCompany\LaravelJsonSchema\Rules\JsonSchemaAttributeRule('type', TypeEnum::class) (be careful to validate the attribute type in this case)

To customize the schema directory, use environment variable JSON_SCHEMA_DIRECTORY or publish the config file.

License

The MIT License (MIT). Please see License File for more information.