sly/relation-bundle
A lightweight PHP package for defining and managing relationships between models. It simplifies linking records, querying related data, and keeping relation logic reusable, with a clean API that fits naturally into existing Eloquent workflows.
TPM verdict: Do not add as a dependency. Treat the repository as prior art — a one-to-two day reference read whose only deliverable is a schema spec and a set of invariants we reimplement in Eloquent.
Architecture fit
*Bundle class, a DependencyInjection extension, container YAML/XML, and Doctrine ORM mappings. None of that bootstraps inside a Laravel application without pulling symfony/framework-bundle and the Doctrine bridge into the app — effectively hosting a second framework and a second persistence model alongside Eloquent.morphToMany / morphMany with pivot columns for relation type, status, and direction. There is no functional gap the bundle fills that we cannot express in a first-party pivot table.Integration feasibility
Technical risk
Key questions to resolve before committing budget
staudenmeir/eloquent-has-many-deep for traversal) already cover ~80%?Stack fit
Migration path
relations pivot — source_type, source_id, target_type, target_id, relation_type, status, created_by, timestamps — with a composite unique index on the five identifying columns and reverse-lookup indexes on the target side.morphToMany both directions, a Relation pivot model for state transitions, query scopes for traversal, and symmetry enforcement centralized in one service class.Compatibility
Sequencing
Maintenance
Support
Scaling
Failure modes
morphToMany does not enforce FK integrity across types — mitigate with application-level cleanup and a periodic integrity sweep.Ramp-up
Recommendation: Reject as a dependency; archive the repository link in the design doc as prior art. Budget a short spike to extract the relation schema and invariants, then build the polymorphic pivot in Eloquent behind a tested single write path. The package's durable value is the problem framing, and that is worth roughly a day of reading.
How can I help you explore Laravel packages today?