Download the PHP package onamfc/eloquent-json-schema without Composer
On this page you can find all versions of the php package onamfc/eloquent-json-schema. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download onamfc/eloquent-json-schema
More information about onamfc/eloquent-json-schema
Files in onamfc/eloquent-json-schema
Download onamfc/eloquent-json-schema
More information about onamfc/eloquent-json-schema
Files in onamfc/eloquent-json-schema
Vendor onamfc
Package eloquent-json-schema
Short Description Generate JSON Schema files from Eloquent models for Laravel applications
License MIT
Package eloquent-json-schema
Short Description Generate JSON Schema files from Eloquent models for Laravel applications
License MIT
Please rate this library. Is it a good library?
Informations about the package eloquent-json-schema
Eloquent JSON Schema
Generate JSON Schema files from your Eloquent models for Laravel applications.
Features
- Single Source of Truth: Infer schema from model casts, database columns, PHPDoc types, and PHP Attributes
- Request & Response Schemas: Generate different schemas for API requests and responses
- Composable Resolvers: Modular system for extracting schema information
- PHP Attributes: Clean metadata injection with custom attributes
- Validation Integration: Middleware for automatic request validation
- OpenAPI Support: Export schemas for Swagger/Redoc documentation
- Versioning: Track schema changes with version management
- Artisan Commands: Easy generation, diffing, and publishing
Installation
Publish the configuration file:
Quick Start
1. Add Attributes to Your Models
2. Generate Schemas
3. Use in Validation
Generated Output
Schemas are saved to storage/api-schemas/{version}/models/:
Available Attributes
#[SchemaName('CustomName')]- Override model name in schema#[Title('Field Title')]- Add title to property#[Description('Field description')]- Add description to property#[Format('email|uuid|date-time')]- Set format constraint#[Enum(['value1', 'value2'])]- Define enum values#[RequestOnly(['field1'])]- Fields only in request schema#[ResponseOnly(['field1'])]- Fields only in response schema
Commands
Configuration
Key configuration options in config/laravel-schema.php:
- version: Schema version identifier
- output_directory: Where to save generated schemas
- type_mapping: How to map database types to JSON Schema
- relationship_depth: Whether to embed relationships or use ID references
- decimal_as: Handle decimals as 'number' or 'string'
Validation Middleware
Register the middleware in your HTTP kernel:
Use in routes:
OpenAPI Integration
Export schemas as OpenAPI components:
Then reference in your OpenAPI spec:
License
MIT License
All versions of eloquent-json-schema with dependencies
PHP Build Version
Package Version
The package onamfc/eloquent-json-schema contains the following files
Loading the files please wait ...