thybag/bonus-laravel-relations
Extends Laravel's Eloquent ORM with bonus relationship types beyond the built-in hasOne, hasMany, and belongsTo helpers, making it easy to define richer model associations and reuse common relation patterns without writing custom query code.
Architecture fit
thybag/bonus-laravel-relations is a model-layer extension to Eloquent: it supplies relation types beyond Laravel's built-in hasOne/hasMany/belongsTo/belongsToMany/*Through set. It does not impose its own persistence, service provider topology, or config surface on the host application, so it slots into the existing domain layer without altering application architecture. Fit is highest for applications with legacy or denormalized schemas where the desired relation cannot be expressed with core Eloquent relations without raw joins or manual hydration.
Integration feasibility Low effort. Adoption is a Composer require plus declarative relation methods on affected models — no schema migration, no data backfill, no queue or config changes. Release 0.6.0 widens framework support to Laravel 13, which is a compatibility release rather than an API release; the changelog contains a single line and no stated behavior changes.
Technical risk
0.x, semver permits breaking changes in minor releases. 0.5.1 → 0.6.0 is a minor bump and could, in principle, carry behavioral change. The changelog does not affirm backward compatibility or state whether Laravel 10/11/12 remain supported.Illuminate\Database\Eloquent\Relations\Relation and lean on query-builder internals. These are the surfaces most likely to shift across Laravel majors, which is precisely why this release exists. The failure mode is subtle — incorrect SQL or silently wrong result sets rather than a hard exception.Key questions
composer.json constraint range and minimum PHP version?with() eager loading and whereHas() equivalently to core relations? This determines whether they can be used on hot paths.Stack fit Requires a Laravel application on Eloquent with a PHP version satisfying Laravel 13's floor (verify against the widened constraint — Laravel 13 raises the PHP minimum, so 0.6.0 may implicitly tighten the PHP requirement even for teams staying on Laravel 12). Teams on Laravel 10 or 11 should confirm their version remains in the supported range before bumping.
Migration path
composer require thybag/bonus-laravel-relations:^0.6 in a branch, or ~0.6.0 if we want to exclude future unvetted minors (recommended given 0.x).composer.lock to confirm no transitive surprises.Compatibility
Treat this as a version-matrix decision per application, not a fleet-wide bump. Applications already on Laravel 13 must take 0.6.0 (0.5.1 likely conflicts). Applications on Laravel 11/12 have no functional reason to move and should stay on 0.5.1 until their own framework upgrade window opens, reducing the number of variables in flight. Because the changelog does not enumerate a compatibility matrix, the constraint in composer.json is the only source of truth — read it directly rather than trusting the release title.
Sequencing Adopt 0.6.0 as part of the Laravel 13 upgrade branch, never ahead of it. Order: (a) confirm framework upgrade green on core packages, (b) bump this package, (c) re-run relation-dependent queries against staging data, (d) merge. If the Laravel 13 upgrade is not scheduled, defer this bump — there is no feature payload to justify the churn.
Maintenance
Near-zero ongoing cost in steady state; the cost is concentrated in framework upgrade windows. The package is a passive dependency with no runtime services. Risk is governance, not operations: assign an internal owner for the dependency and review upstream activity at each Laravel major. Prefer ~0.6.0 constraints so an unreviewed 0.7.0 cannot land in production via a routine composer update.
Support Community-only: GitHub issues and the maintainer's availability. There is no vendor SLA and no commercial backing. Any production incident traced to a relation's SQL generation will be debugged in-house. Budget for that in on-call expectations — a wrong-join bug surfaces as bad data in a report or UI, which is more expensive to diagnose than a 500.
Scaling
Bonus relations compile to additional joins or correlated subqueries, same as core *Through relations. Watch three things: join depth on tables with wide indexes, N+1 patterns where a custom relation is lazy-loaded in a loop, and whether the relation supports eager loading at all. Benchmark any relation used in a list endpoint or report before rollout; add DB::listen-based query-count assertions in tests for the endpoints that consume them.
Failure modes
Ramp-up Minimal. Any developer fluent in Eloquent relations can read and write these in under an hour. The real ramp-up cost is institutional knowledge about which models use non-core relations and why — capture that in the model docblocks or an ADR so the next framework upgrade does not require archaeology.
How can I help you explore Laravel packages today?