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

Eloquent Mutators Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Model-layer standardization: Decide whether derived attributes (full names, formatted currency, status labels, slug generation, audit fields) live in one reusable, testable place rather than being copy-pasted as getXAttribute/setXAttribute methods across dozens of Eloquent models.
  • Build vs. buy for internal conventions: Informs whether to adopt a small MIT package for accessor/mutator reuse or write an in-house trait. This is a tactical dependency decision, not an architecture decision — the package is a thin utility, so the switching cost is low either way.
  • Technical debt and onboarding: A shared set of mutator classes gives new engineers a single, discoverable pattern for "how we format/parse model data here," reducing the cognitive load of model-by-model conventions.
  • Use cases worth validating: Multi-tenant apps with repeated derived fields, domain models with consistent formatting rules (phone, currency, dates), and CRUD-heavy admin surfaces where the same accessors are needed across many entities.
  • Roadmap framing: This is a developer-productivity enabler, not a customer-facing feature. It supports decisions about engineering velocity and code hygiene; it should not be prioritized on a product roadmap unless model-layer duplication is a measured drag on delivery.
  • Dependency governance: Supports a decision on whether a low-footprint, single-maintainer package is acceptable under your third-party dependency policy versus a small internal implementation.

When to Consider This Package

Consider it when:

  • You have repeated accessor/mutator logic across multiple Eloquent models and want a reusable, named class instead of duplicating trait methods.
  • You want consistent, testable formatting/parsing rules (dates, currency, names, slugs) applied uniformly across entities.
  • Your team is on a compatible Laravel version and the package's surface area aligns with the accessors/mutators you actually need.
  • You value a small, MIT-licensed, low-coupling dependency that is easy to vendor or replace.
  • You are comfortable with a lean maintenance profile — few dependents, small community — and are prepared to own the code if upstream stalls.

Look elsewhere when:

  • Your need is casting and serialization rather than getters/setters — Laravel's native casts, custom cast classes, and the modern Attribute approach cover much of this without a dependency.
  • You need DTOs, API resources, or transformation layers — those are a different problem than model accessors.
  • Your dependency policy requires active community support or multiple maintainers; 45 stars and zero dependents signal a niche utility, not a de facto standard.
  • You are on a Laravel version where native patterns already eliminate the duplication — adopt only if the package adds net clarity over the framework.
  • You need performance-sensitive accessor pipelines at scale — benchmark before standardizing.

How to Pitch It (Stakeholders)

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.

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.
robertmarney/lara-hierarchial-collections
simonschaufi/rule-doc-generator
emissaoja/emissaoja
blackbricksoftware/gravityforms-civicrm-form-processor
al-rahabi/fancy-crud
jinas/dhivatar-component
mltstephane/laravel-quality
bernskiold/laravel-talentlms
bernskioldmedia/laravel-form-architect
youbar/easy-crud
c-point-labs/laravel-hostyourai
dbravoan/dbcms-admin-theme-dbcms
dbravoan/dbcms-theme-db-cyber
dbravoan/dbcms-blocks-basic
dbravoan/dbcms-module-content-audit
dbravoan/dbcms-module-ai-assistant
paygate-to/paygate-php
padosoft/askmydocs-connector-base
defstudio/supercharged-carbon
bernskioldmedia/laravel-matomo