oza/laravel-database-jsonable
A Laravel package that adds JSON column support to Eloquent models, making it easy to store, retrieve, and cast structured JSON data in your database without custom accessors or mutators.
json column type plus Eloquent $casts = ['field' => 'array']. The package's core value proposition — serializing an array/object into a database column and hydrating it back on read — is already first-party Laravel behavior, so this assessment mainly informs a "don't add the dependency" call.Consider it only in narrow circumstances:
$casts (e.g., wanting fill/retrieve helpers on a non-Eloquent or non-standard model, or a dot-notation accessor pattern the native cast doesn't give you), the package may save a small amount of boilerplate — but that boilerplate is roughly 5–10 lines of a custom cast or accessor/mutator.Look elsewhere (specifically: the framework) when:
json/text columns with array/object/collection casts, AsArrayObject, AsCollection, and ->whereJsonContains() / ->whereJsonLength() cover the described functionality. This is the default recommendation.Adoption criteria, if you insist on a formal gate: at least one of (a) a genuinely missing native capability documented in a spike, (b) an existing internal fork you already maintain, or (c) a throwaway prototype with a scheduled removal date.
For executives: We evaluated a community Laravel package for storing JSON data in database columns. My recommendation is not to adopt it. The capability it provides — save an array to a column, read it back as an array — is built into the framework we already pay for, so the package adds a dependency without adding capability. Its community footprint is negligible (19 stars, zero known dependents, single maintainer), which means if it breaks on a framework upgrade, we own the fix. Cost of the native approach is effectively zero; cost of the dependency is a small but permanent maintenance and supply-chain liability in our data layer — the worst place to carry one.
For engineering: Use native Eloquent casting — $table->json('meta') plus protected $casts = ['meta' => 'array'] (or AsArrayObject/AsCollection for mutable/collection semantics). For querying, use whereJsonContains / whereJsonLength; if you need to filter or aggregate on a nested key at scale, promote it to a real column with an index rather than reaching for a package. If a specific ergonomic gap shows up in a spike, write a 10-line custom cast — that's cheaper to own than this dependency and it stays in our code review path.
Ask: Approve the "no new dependency" call and confirm the JSON-column usage guidance (sparse/flexible data yes; queried or joined data no) goes into our data-modeling standards.
How can I help you explore Laravel packages today?