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 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

At a glance

Frequently asked questions about Laravel Translatable And Injectable
How do I install creativeorange/laravel-translatable-and-injectable in a Laravel app?
Install it with Composer using creativeorange/laravel-translatable-and-injectable and pin ^3.0.1 so production cannot resolve 3.0.0. Publish any package config if required, then add the provided traits to the Eloquent models that need translated attributes or injected services. Start with one non-critical model and verify locale reads before expanding to other models.
Which Laravel and PHP versions does this package support?
The package targets modern Eloquent applications, but the authoritative answer is in its composer.json constraints and README. Version 3.0.1 only changed composer.json, so confirm the exact Laravel, illuminate, and PHP constraints rather than assuming support. Run composer why-not against your locked Laravel and PHP versions before adopting it.
How does fallback work when a translated attribute is missing?
The package resolves translated attributes for the current application locale and supports automatic fallback when a translation is missing. Fallback behavior is configurable, so the exact result depends on your configuration rather than being hardcoded to null or an exception. Test missing-translation cases explicitly, especially if your app already normalizes locale fallback in API resources.
Can I use it alongside spatie/laravel-translatable?
Coexistence is not clearly documented, and both packages hook into Eloquent attribute handling, so trait collisions on getAttribute or setAttribute are possible. Do not apply both translation traits to the same model without a scratch-branch test. Validate whether this package should replace your existing translation storage or sit beside it before committing to either approach.
Does it work with eager loading, $with, and toArray() or API resources?
The release notes do not confirm how the injection layer interacts with $with, eager loading, toArray(), or API resources. Because injected attributes and relations may appear on models without being declared in the model file, test serialization output carefully. Apply the trait to one content or page model first and compare resource responses before using it on core models.
Will PHPStan, Larastan, or my IDE understand injected model attributes?
Injected attributes and relations are implicit magic, so IDEs, PHPStan, and Larastan may not see them without docblocks or stubs. Run Larastan or php -l against the first trait-bearing model to catch signature conflicts and static-analysis gaps early. Expect some onboarding and debugging cost because the model file no longer lists every available attribute.
How do I upgrade from version 2.x to 3.x?
Check the repository release notes and README for a published 2.x to 3.x upgrade guide before changing constraints. The 3.x major was likely cut for a Laravel compatibility change, while 3.0.1 is a composer.json-only patch with no source or API changes. Pin ^3.0.1 in a scratch branch, confirm fresh installs work, and migrate one model at a time.
What changed in version 3.0.1 of laravel-translatable-and-injectable?
Version 3.0.1 contains a single merged composer.json update with no source, test, or API changes, so it is a metadata-only patch release. In practice that usually means a dependency constraint adjustment rather than a behavioral change. It should carry no migration burden, but confirm whether it restores installability that 3.0.0 may have lacked.
Is this package safe to use in production?
It is a thin trait layer over Eloquent that fits small-to-mid Laravel apps with a handful of locales, but it is maintained by a single author with low PR cadence. This release provides no evidence of CI status, test matrix coverage, or test changes, so treat maintenance risk as real. Pin the version, avoid making it load-bearing on commerce or user models initially, and monitor releases.
What are alternatives to this package for translatable Eloquent models?
Common alternatives include spatie/laravel-translatable, JSON translation columns with custom accessors, or separate translation tables with your own fallback logic. This package differs by also injecting container-resolved services and dynamic values into translation strings at runtime. Compare fallback behavior, static-analysis support, and trait collisions with whatever translation storage you already use.
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.
uni-method/symfony-lib
tacticmedia/scim-server-bundle
neika-ai/symfony-bundle
mattleads/agent-publishing-bundle
glavweb/framework-bundle
glavweb/extra-bundle
glavweb/api-bundle
glavweb/admin-bundle
adachsoft/api-version-bundle
elsayed85/laravel-api-exceptions
ouhssini/laravel-demo-mode
daworks/ncloud-outbound-mailer-driver
gp247/cms
ignibyte/aic-gates
nexa-merchant/blog
novasa/laravel-language-center
opencage/geocode
adolfoholzer/parameters
livenetworks/ln-starter
cgv/localized-resource