New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

kirschbaum-development/eloquent-power-joins

The Laravel magic applied to joins.
49,111,681 1,571
Install
composer require kirschbaum-development/eloquent-power-joins
Latest Version:4.3.6
PHP:^8.2
Laravel:11 · 12 · 13
Older releases:6 – 10
License:MIT
Last Updated:Oct 24, 2026
Links: GitHub  ·  Packagist
Maintainer: luisdalmolin

Eloquent Power Joins

The Laravel magic you know, now applied to joins

Laravel Supported Versions run-tests MIT Licensed Latest Version on Packagist Total Downloads

Eloquent is very powerful, but it lacks a bit of the "Laravel way" when using joins. This package lets you write joins the Laravel way: more readable, with less code, and without leaking implementation details where they don't belong.

Instead of writing joins by hand:

User::select('users.*')
    ->join('posts', 'posts.user_id', '=', 'users.id')
    ->join('comments', 'comments.post_id', '=', 'posts.id');

You can use the relationships you've already defined:

User::joinRelationship('posts.comments');

Polymorphic relationships, soft deletes, model scopes, aliases and extra relationship conditions are all handled for you. You can also query relationship existence using joins and sort results by columns or aggregations from related tables:

// Query relationship existence using joins instead of where exists
User::powerJoinHas('posts');

// Order by a related column
User::orderByPowerJoins('profile.city');

// Order by an aggregation on a related table
Post::orderByPowerJoinsCount('comments.id', 'desc');

Documentation

You'll find the full documentation on our documentation site.

You can also read a more detailed explanation of the problems this package solves in this blog post.

Installation

You can install the package via composer:

composer require kirschbaum-development/eloquent-power-joins

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email security@kirschbaumdevelopment.com instead of using the issue tracker.

Credits

Sponsorship

Development of this package is sponsored by Kirschbaum Development Group, a developer driven company focused on problem solving, team building, and community. Learn more about us or join us!

License

The MIT License (MIT). Please see License File for more information.

Related Packages

kitloong/eloquent-power-joins-with-compoships

The Laravel magic applied to joins, with compoships support

18,607 26
yadakhov/insert-on-duplicate-key

A trait for MySQL INSERT ON DUPLICATE KEY UPDATE.

3,117,053 275
pendalff/eloquent-joins

Support for joins at the relationship level in Laravel's Eloquent ORM.

2,665 1
terranc/eloquent-insert-on-duplicate-key

Macros for INSERT ON DUPLICATE KEY UPDATE and INSERT IGNORE with Eloquent

1,993 0
llama-laravel/eloquent

Extends Laravel Eloquent ORM.

93 2

Version History

Version Released PHP Laravel License
4.3.6 ^8.2 ^11.42|^12.0|^13.0 MIT
4.3.5 ^8.2 ^11.42|^12.0|^13.0 MIT
4.3.4 ^8.2 ^11.42|^12.0|^13.0 MIT
4.3.3 ^8.2 ^11.42|^12.0|^13.0 MIT
4.3.2 ^8.2 ^11.42|^12.0|^13.0 MIT