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 Computed Properties Laravel Package

n7olkachev/laravel-computed-properties

Add computed properties to your Laravel Eloquent models, calculated on the fly like accessors but excluded from the database. Keep models lean, reuse derived values across queries and serialization, and write less boilerplate.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Feature scoping for derived/read-only model attributes. The package targets a narrow but recurring need: exposing computed values (full names, formatted totals, status labels, denormalized display strings) on Eloquent models without hand-wiring accessors or bloating API resources. Use it to estimate effort on features like "show a customer's lifetime value" or "display a formatted address" — it's a convenience layer, not a data layer.
  • Build vs. buy for model/DTO ergonomics. This is a ~100-line trait-style utility, not infrastructure. It informs the recurring PM question: do we hand-roll a small internal helper (a few hours of engineering, fully owned) or pull a community package (near-zero cost today, ownership risk later)? For most teams the honest answer is "build a 50-line internal trait," which makes this package a reference implementation rather than a dependency.
  • Roadmap signal: framework version strategy. Last release was October 2018, meaning it targets the Laravel 5.x era. Modern Laravel (9+) ships Attribute::make() with shouldCache(), plus $appends and API Resources, which cover most of the same ground natively. Adoption decisions here are really decisions about how long we stay on older framework versions.
  • API/response-shaping consistency. Supports standardizing how computed fields appear in JSON responses across models — a small but real lever on API consistency and frontend contract stability.
  • Low-priority technical debt triage. 187 stars and no release in ~7 years place this firmly in "convenience, easily replaced" territory. Useful as an input when prioritizing dependency cleanup against customer-facing work.

When to Consider This Package

Consider it when:

  • You're on a legacy Laravel codebase (5.5–7.x) where multiple computed attributes depend on each other and accessor chains get messy, and you want a quick, low-blast-radius DX win.
  • You have a small number of models with several interdependent derived attributes, and the team is already comfortable with community micro-packages.
  • You want a read-only reference for how to implement cached, dependency-aware computed properties internally — vendor/fork it and own it.
  • The cost of a wrong choice is genuinely low: it's additive, trait-based, and removable without schema or data migration.

Look elsewhere when:

  • You're on Laravel 9+ — native Attribute objects with caching plus $appends and API Resources are the supported path; adding an unmaintained package buys little.
  • Computed values are business-critical (pricing, billing, compliance reporting). Unmaintained single-maintainer code should not sit on a critical path; write and own the logic.
  • The computation is expensive, cross-model, or needs querying/filtering — this is presentation-layer sugar, and derived data belongs in a query, a database view, or a materialized/denormalized column.
  • Your org requires active maintenance, security response, or vendor support for third-party dependencies. There is no such guarantee here.

How to Pitch It (Stakeholders)

  • To executives: This is a small, free developer-convenience library that makes derived fields on data models slightly cleaner to write. It is not strategic, not customer-visible, and not a long-term dependency — expect to replace it with a short internal equivalent or native framework features. Recommend: allow a time-boxed evaluation in a non-critical area, do not standardize on it.
  • To engineering: Traits that add cached, dependency-aware computed properties to Eloquent models. It solves a real annoyance (accessor soup and repeated computation), but it's from 2018 with no releases since, so treat it as a pattern to borrow rather than a package to depend on. Preferred path: copy the approach into an internal trait (~50 lines, fully testable) or, on Laravel 9+, use cached Attribute objects plus $appends.
  • Decision framing: Low upside, low downside, moderate ownership risk. Verdict: evaluate, don't adopt as a standard; revisit only if the team is stuck on an older framework version and the convenience justifies the maintenance tail.
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.
ignibyte/aic-framework
glavweb/data-schema-bundle
glavweb/datagrid-bundle
tacticmedia/scim-server
uni-method/frame
neika-ai/sdk
adachsoft/php-code-style
pharaonic/laravel-notification-dependencies
beautinow/translug
dev-brainiac/bot-cloaked
octoberrain/html
octoberrain/extension
octoberrain/exception
octoberrain/contracts
adachsoft/api-version-bundle
cgv/localized-resource
noith/settings
kda/laravel-package
kda/filament-dynamic-navigation
bypersoft/signbox