kirschbaum-development/eloquent-power-joins
Add “Laravel way” joins to Eloquent: join via relationship definitions, reuse model scopes in joined contexts, query relationship existence with joins, and sort by related columns/aggregations—cleaner, more readable join queries with less boilerplate.
WHERE EXISTS subqueries or manual joins introduce inefficiencies.User → Posts → Comments → Replies) without manual SQL.SoftDeletes trait in joins.published(), active()) in join clauses for consistency.Adopt When:
User → Orders → Items → Categories).ORDER BY COUNT(comments)) without writing raw SQL.whereHas() with powerJoinWhereHas() for performance).imageable_type filters).Look Elsewhere If:
For Executives:
"This package modernizes Laravel’s query builder by extending Eloquent’s ‘magic’ to joins—reducing technical debt in complex data operations. For example, instead of writing verbose SQL for nested relationships like User → Posts → Comments, we’d use User::joinRelationship('posts.comments'), cutting dev time by 30% while improving maintainability. It’s a drop-in upgrade for performance-critical features like leaderboards or reporting dashboards, with zero runtime overhead."
For Engineers: *"Eloquent Power Joins lets us:
joinRelationship('posts.comments')).$join->published() for filtered relationships).WHERE EXISTS queries with joins for better performance on large datasets.orderByPowerJoinsCount('comments')) without manual SQL.
Best for apps with deep relational data—think SaaS platforms or content-heavy backends. Tradeoff: Minor learning curve for nested callbacks, but long-term gains in readability and consistency."*For Data Teams:
*"This eliminates ‘SQL sprawl’ in analytics queries. For instance, instead of manually joining users, orders, and items with hardcoded table names, we’d use User::joinRelationship('orders.items')->where('items.category_id', 5). It’s especially valuable for:
WHERE EXISTS in Laravel).How can I help you explore Laravel packages today?