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

Laravel Translatable And Injectable Laravel Package

creativeorange/laravel-translatable-and-injectable

Add translatable attributes to Laravel Eloquent models and inject dynamic values into translation strings at runtime, so locale-aware text can include model data, placeholders, or custom variables without hardcoding.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Package: creativeorange/laravel-translatable-and-injectable — a Laravel package providing Eloquent traits for translated attributes and automatic injection of related/translated records onto models.

What actually changed in v3.0.1: A single merged PR (Update composer.json) with no source, test, or API changes. This is a metadata-only patch release. In practice this almost always means a dependency-constraint adjustment (Laravel framework, illuminate/*, PHP version, or a dev-tool bump in require-dev) rather than a behavioral change. The v3.0.0 → v3.0.1 delta carries no migration burden for consumers, but it also carries very little signal about project health.

Architecture fit: The package is a thin trait layer over Eloquent. That is architecturally cheap — no service container gymnastics, no custom query builder, no middleware — but it is also the kind of package that reaches into model lifecycle hooks (getAttribute, __get, relation resolution), which is where "thin" packages quietly become load-bearing. Fit is good for small-to-mid Laravel apps with 2–5 locales; fit degrades in apps with heavy read replicas, aggressive caching, or API resources that already normalise locale fallback themselves.

Integration feasibility: High. Composer install, publish config (if any), add traits to models. Typical effort is hours, not days, for a first vertical slice.

Technical risk:

  • Abandonment / bus factor. Single-maintainer package with a low PR cadence (this is PR #2). A composer.json-only release after a major bump is a weak maintenance signal.
  • Version 3.x churn. The major was presumably cut for a Laravel compatibility break. A fast follow patch suggests constraint tidying post-release — worth confirming it wasn't a "fix the install" patch, which sometimes indicates the 3.0 tag was published with incorrect constraints and would have broken fresh installs.
  • Implicit magic. "Injectable" behaviour means attributes/relations appear on models that aren't declared in the model file. This is a real onboarding and debugging cost and a source of static-analysis gaps (IDE, PHPStan, Larastan).
  • Test surface unknown. No evidence in this release of CI status, matrix coverage, or test changes.

Key questions to the maintainers before adoption:

  1. What exactly changed in composer.json (constraint floors/ceilings, PHP version), and does 3.0.1 restore installability that 3.0.0 lacked?
  2. Which Laravel and PHP versions are officially supported and tested in CI?
  3. What is the fallback behaviour when a translation is missing — null, locale fallback chain, or exception?
  4. Does the injection layer interact correctly with $with, eager loading, and toArray()/API resources?
  5. Is there a published upgrade guide for 2.x → 3.x?

Integration Approach

Stack fit: Assumes Laravel 9/10/11-class Eloquent. It complements rather than competes with spatie/laravel-translatable — validate whether it can coexist with (or should replace) whatever translation storage you already use. If you already run Spatie's package or store translations in JSON columns, confirm there is no trait collision on getAttribute/setAttribute.

Migration path:

  1. Pin ^3.0.1 in a scratch branch; do not let 3.0.0 be resolvable in production.
  2. Apply traits to one non-critical model first (e.g. a content/page model), not a core commerce or user model.
  3. Backfill translations via a one-off artisan command; verify no destructive cast changes on existing columns.
  4. Only after a full release cycle, expand to remaining models.

Compatibility checks: Run composer why-not against your locked Laravel and PHP versions; confirm the new constraint doesn't silently downgrade a shared transitive dependency. Check php -l/Larastan output on the first trait-bearing model to catch signature conflicts.

Sequencing: This package is a leaf dependency — schedule it after the Laravel major upgrade lands, not during it. Doing both simultaneously makes it impossible to attribute a regression to framework or to this package.

Decision: Adopt for a pilot. Treat 3.0.1 as "3.0.0 with fixed metadata," not as a maintained stable line, until a second substantive release or an active issue-response pattern is observed.

Operational Impact

Maintenance: Low code surface, so maintenance is mostly constraint drift. Budget one review per Laravel major. The real cost is knowledge concentration: whoever wires up the traits owns them, and the "injectable" behaviour is invisible to a reader of the model class.

Support: No vendor. Escalation path is GitHub issues on a low-traffic repo, or a fork. For a package touching model attribute resolution, assume you may need to patch it yourself. Confirm your team has a named owner comfortable with Eloquent internals.

Scaling: Traits add per-model overhead on hydration and attribute access. This is negligible at typical page workloads and measurable only in bulk export/reporting paths that hydrate tens of thousands of records. If you have such paths, benchmark them explicitly and consider bypassing the trait with raw query builder there.

Failure modes to monitor:

  • Silent nulls. Missing translation returns empty rather than failing loudly → blank CMS fields in production. Add a query/assertion in staging that flags models missing any configured locale.
  • Composer drift. A future patch tightens constraints and blocks a Laravel security upgrade. Pin and review, don't float *.
  • Trait collision. Another package overriding attribute access masks translations intermittently.
  • N+1 on injected relations. Watch query counts on any list view immediately after rollout.

Ramp-up: Half a day for a mid-level Laravel developer to be productive; roughly two days to be confident enough to debug trait-level issues. Required reading: the package README plus your own models' trait usage. Add a short internal note documenting which models use these traits and why — the next developer will not find it by reading the model files.

Recommendation: Proceed to a scoped pilot. Do not treat v3.0.1 as evidence of active maintenance; it is a metadata correction. Set a review checkpoint in two quarters: if no substantive commits and no CI/test visibility by then, plan to vendor the traits into your own codebase (they are small) to remove the dependency risk.

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.
3mdikram/worldmoneywords
snowsoft/config
itmosoft/laravel-subscriptions
larva/laravel-ai-qwen
diephp/sequences
users-au/socialite-provider
twidpay/twid-logger
mrnewport/laravel-plaid
mrnewport/laravel-repo
mrnewport/laravel-docsign
mrnewport/laravel-stow
mrnewport/laravel-flow
mrnewport/laravel-priceable
mrnewport/laravel-nestedterms
fredmeng/laravel-apidoc-generator
itstructure/laravel-multilingual-tools
pdustdar/elasticsearch
markupai/php-sdk
rlacerda83/lumem-microservice-shipment
uni-method/symfony-lib