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.
Architecture fit
$appends, and it introduces no new infrastructure, service provider surface, or storage.full_name → display_name → sort_key) that currently recompute repeatedly during serialization, exports, or search indexing.Attribute objects with shouldCache(), or that treat models as thin persistence objects. The package's differentiator is dependency ordering, not caching alone, so the value proposition must be proven against a concrete model.Integration feasibility
toArray(), API Resources, and a queued export.fill/setAttribute invalidation, refresh(), replicate(), dirty tracking, $hidden/$appends interaction, and whether computed values participate in toJson consistently across resources.Technical risk
getAttribute, mutators, serialization). These are the parts of Eloquent that shift most between major versions.toArray() into a query storm.Key questions
shouldCache() plus explicit invalidation already solve 80% of it?Stack fit
Migration path
refresh, replicate, and JSON output.HasComputedProperties abstraction (our own trait/interface) that the fork satisfies. Application models depend on our contract, not the vendor namespace, so replacement is a one-file change.Compatibility
composer why-not for conflicts with API Resources, IDE helper, and any package that overrides getAttribute or serialization.withoutAppends, makeHidden, only, and resource whenLoaded — these are where computed properties most often leak.Sequencing
Maintenance
Support
Scaling
Failure modes
refresh() — silent, hardest to detect.toArray().Ramp-up
How can I help you explore Laravel packages today?