awobaz/eloquent-mutators
Add get and set mutators to Eloquent attributes without boilerplate accessor methods. Define reusable mutator classes and attach them to model attributes at runtime, keeping models clean and mutator logic reusable across your Laravel projects.
getXAttribute/setXAttribute methods across dozens of Eloquent models.Consider it when:
Look elsewhere when:
Attribute approach cover much of this without a dependency.For executives: This is a small, free, open-source utility that helps engineers stop rewriting the same data-formatting code in every part of the application. It is a low-cost, low-risk efficiency play — no licensing fees, easily removed, and it improves consistency in how data is presented and stored. It will not move customer metrics on its own; the value is reduced engineering rework and fewer inconsistencies in derived data. Recommendation: approve as a tactical engineering standard if model-layer duplication is a real cost, and treat it as replaceable if the project stalls.
For engineering: Adopt awobaz/eloquent-mutators as a thin convention for extracting reusable accessors/mutators into named, testable classes instead of scattering getXAttribute methods across models. It reduces boilerplate, centralizes formatting/parsing rules, and keeps behavior consistent across entities. Trade-offs to accept explicitly: single maintainer, small community, and a narrow scope — so wrap usage behind our own conventions, keep the dependency shallow, and avoid letting it become load-bearing for casting or serialization. If it is abandoned, the exit path is a straightforward in-house trait. Decide based on measured duplication, not aspiration.
How can I help you explore Laravel packages today?