folklore/eloquent-json-schema
Generate JSON Schema definitions directly from your Eloquent models. This package inspects attributes, casts, and relationships to build accurate schemas, making it easy to document APIs, validate payloads, and generate typed clients.
Consider it when:
Look elsewhere when:
json validation rule or a maintained JSON Schema validator directly.$ref resolution, custom formats, draft-2020-12 support, or database-level enforcement — a small README-only package almost certainly won’t cover this, and a dedicated schema registry is the better bet.For executives: This is a small Laravel utility that generates JSON Schema definitions from existing Eloquent models, with the goal of keeping API documentation, client SDKs, and validation rules in sync with the database instead of hand-writing schemas. It is not a mature dependency — 3 GitHub stars, no known dependents, and a low opportunity score — so I would not frame it as a platform investment. The business value is optionality and insight: it lets us cheaply test whether “generate schemas from models” fits our API and integration roadmap before committing engineering time. Recommendation: run a time-boxed spike or use it as a design reference; if the pattern proves valuable, build a small first-party exporter around a maintained JSON Schema library. Do not put it on the critical path.
For engineering: Treat this as a reference implementation to read, not a foundation to adopt. The package is roughly one cast/exporter class plus glue; the value is the pattern of deriving schemas from model definitions. Before any use, verify which JSON Schema draft it targets, which underlying validator/tooling it relies on, its illuminate/* and PHP version constraints, and whether it actually validates or merely emits schemas. Budget half a day to read the source and run it against 20–30 real model definitions, including an edge case. In parallel, draft the ~50-line first-party equivalent behind a small interface so the implementation stays swappable. Given the adoption signals, the custom implementation is the likely winner — use the package as a source of design ideas and a cheap way to socialize the schema-generation approach with the team.
How can I help you explore Laravel packages today?