Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Eloquent Json Schema Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Single-source-of-truth for API contracts. The package derives JSON Schema definitions from Eloquent models, which supports a decision about whether schemas, API docs, and client SDKs should be generated from the database layer or maintained by hand. This is the PM lever: making the model the canonical contract lowers drift between backend, docs, and consumers — if the generated schemas are trustworthy enough to ship.
  • Build vs. buy vs. borrow. With 3 stars, 0 dependents, and a low opportunity score, the realistic PM choice is between (a) a half-day spike using this as a pattern, (b) building a small first-party schema exporter around a maintained schema library, or (c) standardizing on a dedicated schema registry/service. The package is a reference implementation, not a platform bet; the decision it informs is where the schema-generation logic should live.
  • Validation and contract location. It helps scope whether validation should live at the Eloquent model boundary, in form requests/API middleware, at the database layer, or in a separate registry. Because it emits/represents schemas as data, it makes “schema as a model-side artifact” concrete and cheap to prototype — useful input to a validation strategy decision.
  • Roadmap for schema-driven features. It supports go/no-go on features that benefit from a machine-readable contract: public API docs, generated client SDKs, connector/integration payloads, tenant-configurable forms, low-code metadata, and event/queue message definitions. If the product is moving toward external integrations or a partner API, the ability to emit spec-compliant schemas from existing models is a real accelerator.
  • Documentation and developer-experience investment. For API-first products, it frames the decision of whether to invest in automated contract generation versus manual OpenAPI/JSON Schema authoring. The package is small enough to test the “generate, don’t write” hypothesis in a time-boxed experiment.
  • Risk and maintenance posture. A 3-star, zero-dependent package supports a clear roadmap decision — prototype with it, fork it, or explicitly avoid it on the critical path. It gives the PM a defensible, evidence-based reason to prefer a first-party implementation over adopting it as a dependency.

When to Consider This Package

Consider it when:

  • You are on Laravel with Eloquent and want to test generating JSON Schema from existing model definitions as part of an API-docs or SDK-generation spike.
  • The goal is a time-boxed proof of concept — a day to validate that schema-from-model generation fits your stack — not a permanent dependency.
  • Your team is comfortable reading the source, pinning a commit, and forking or reimplementing the small amount of logic if the package stalls.
  • The use case is internal tooling, admin-configured metadata, or early product discovery, where speed and insight matter more than long-term dependency risk.
  • You want a design reference to copy into a small first-party schema exporter rather than a package to install and maintain.

Look elsewhere when:

  • You need a production-critical, long-lived dependency. Three stars and zero dependents mean no ecosystem support, security response, or upgrade path.
  • You need guaranteed compatibility with current PHP/Laravel releases, static analysis, or framework upgrades — there is no evidence of anyone running this against a modern Laravel version.
  • The requirement is request/payload validation rather than schema generation. Use Laravel’s json validation rule or a maintained JSON Schema validator directly.
  • Your schemas require versioning, $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.
  • You are not using Eloquent, or JSON isn’t the right storage model — normalized tables or a document database may serve better.

How to Pitch It (Stakeholders)

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.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
snowsoft/faker
meditationsteps/blogetc
animalyoung/laravel-influxdb
onix-solutions/sms-telera
lonely-lights/prosetta
oxygen/data
oxygen/core
jengo/base
xiloryx/log-collector
a21ns1g4ts/filament-stripe
la-php/laravel-admin
artisan-build/community-prompts
vleroy/smart
ayles-software/laravel-australian-public-holidays
cboxdk/laravel-id-spatie
cboxdk/laravel-id-billing
cboxdk/laravel-id-billing-bridge
simple-as-fuck/php-performance-log
hsluv/hsluv
seampact/codegen