dutchcodingcompany / laravel-json-schema
Adds a service provider for json schemas
Installs: 981
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 4
Forks: 1
Open Issues: 0
pkg:composer/dutchcodingcompany/laravel-json-schema
Requires
- php: ^8.2
- laravel/framework: ^11.0 | ^12.0
- swaggest/json-schema: ^0.12.33
Requires (Dev)
This package is auto-updated.
Last update: 2025-10-14 13:45:59 UTC
README
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
- Create a json schema in the schema directory, eg.
storage/app/schema/example.json - 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 attributetypein 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.