masterfri/laravel-smart-relations
Laravel Smart Relations streamlines Eloquent relationship management in Laravel with smarter helpers and conventions for defining, querying, and working with model relations, reducing boilerplate and keeping model code cleaner and easier to maintain.
morphTo/morphMany per domain is cheap for one team and expensive across five. The package converts a repeated custom-build pattern into one reviewed dependency, so the comparison is "one dependency + migration" vs. "N squad-weeks of divergent implementations."commentable_id/project_id/document_id trio to a comments table. Fewer columns, fewer null checks, fewer per-entity endpoints.Adopt when:
Look elsewhere when:
Release-specific read: v1.2 is additive — polymorphic relations support — with no stated breaking changes or deprecations, so it is a low-risk adoption point. Validate against existing relations in a spike before retrofitting current schemas.
For executives (one paragraph): We're evaluating a small Laravel dependency whose latest release adds polymorphic relations — the ability to attach one record type (comments, tags, attachments, activity) to many different objects. It's an enabler for cross-product engagement features we've repeatedly deferred, and it replaces several one-off implementations across squads with a single reviewed pattern. Cost is one dependency, one migration, and a short technical spike; the main risk is operational discipline around cleanup and indexing, not feature risk. Recommendation: approve a scoped pilot on one low-risk feature before standardizing.
For engineering (one paragraph): v1.2 adds polymorphic relation support with no breaking changes noted. Before adoption, we need a spike covering: enforced morph map aliases (locked early — they're painful to change), index strategy on *_type/*_id pairs, N+1 behavior under realistic list endpoints, orphan-record cleanup and delete/cascade policy (no DB-level FKs available), authorization per morph type via policies, and test coverage for each registered type. Success criteria: one production feature shipped on the package, with documented conventions the next squad can follow unchanged.
Ask: a one-sprint spike plus a named owner for the conventions doc; decision to standardize deferred until the pilot ships.
How can I help you explore Laravel packages today?