we-are-neopix/laravel-model-translation
Add multi-language attributes to Eloquent models with we-are-neopix/laravel-model-translation. Store per-locale values, fall back to defaults, and retrieve translations via simple accessors—no extra tables or schema changes required.
lang/ files for static UI strings. The roadmap should name both mechanisms and the written boundary between them (static copy in lang/, managed content in the package), or the boundary erodes and localization debugging becomes recurring support cost.spatie/laravel-translatable, ~2k stars, JSON column, no join; astrotomic/laravel-translatable, per-model tables, strongest query story) is the low-risk default. This package is defensible only where swappable storage is a genuine, one-sentence requirement. If that sentence cannot be written, the answer is one of the alternatives.null versus default-locale substitution is surfaced as a library detail but ships as a user-visible outcome: blank labels versus English leaking into a localized storefront. Pick deliberately, write it into the acceptance criteria, and test it.laravel/framework and php constraints against your pinned LTS; presence of CI and a test suite covering the DB driver and driver resolution; the DB driver's exact schema, including a composite unique constraint and covering index on the lookup tuple; fallback semantics on a missing translation; and whether eager loading or batch resolution exists to prevent N+1 through API resources and toArray().where/orderBy without dropping to driver-specific code. If the abstraction leaks here it has bought nothing, and a hand-joined table or an in-house trait is the cheaper answer.For executives. This is a small MIT-licensed Laravel package that accelerates multilingual content features by giving models built-in translation support, with database and JSON storage options plus a custom-driver path. It lowers initial engineering effort and preserves flexibility on where translations live. The caveat is material: 40 stars, zero dependent projects, a single maintainer at an agency, and no public evidence of production use. Treat it as a tactical accelerator for one contained, non-critical content feature — not a strategic platform bet. Recommend a short spike behind a go/no-go gate, a thin internal wrapper so the package can be replaced without touching views or controllers, and a documented fallback to an established alternative. Budget one to two engineer-days per Laravel major upgrade to own compatibility, and keep it off any critical path where an unanswered GitHub issue blocks a release.
For engineering. The draw is the driver abstraction: a strategy pattern behind a container-resolved contract, idiomatic Laravel, composing cleanly with app()->getLocale() and existing locale middleware, and confined to a handful of content models without constraining application layering. Install is trivial — composer require, publish config, add the trait, declare $translatable, select a driver — but the estimate is not "hours" until the technical unknowns close: whether the translations table ships a composite unique index and covering index (without them every read scans a table that grows as models × attributes × locales); whether eager loading exists, since lazy trait accessors hide I/O behind property reads and are a classic N+1 in Blade loops and serializers; whether translated values work in where/orderBy; how missing translations resolve; and whether any caching layer exists and how it invalidates on write. Exclude the JSON driver by policy on read-only or scaled deployments. Plan the exit before the first trait: route access through an application repository so the trait stays the only coupling point. Proposed sequencing: a 1–2 day spike on one low-risk content model with a query-count measurement on a listing page; a build-vs-adopt checkpoint that treats an unfavourable answer on querying or eager loading as a decision to write the in-house trait instead; a pilot on one non-critical, high-read model; then hardening — indexes, caching with deterministic write invalidation, the wrapper class, a fallback-behavior test, and a per-model rollback flag — before expanding model by model.
How can I help you explore Laravel packages today?