kirschbaum-development / eloquent-power-joins
The Laravel magic applied to joins.
Package info
github.com/kirschbaum-development/eloquent-power-joins
pkg:composer/kirschbaum-development/eloquent-power-joins
Requires
- php: ^8.2
- illuminate/database: ^11.42|^12.0|^13.0
- illuminate/support: ^11.42|^12.0|^13.0
Requires (Dev)
- friendsofphp/php-cs-fixer: dev-master
- laravel/legacy-factories: ^1.0@dev|dev-master
- orchestra/testbench: ^9.0|^10.0|^11.0
- phpunit/phpunit: ^10.0|^11.0|^12.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
- dev-master
- 4.3.3
- 4.3.2
- 4.3.1
- 4.3.0
- 4.2.11
- 4.2.10
- 4.2.9
- 4.2.8
- 4.2.7
- 4.2.6
- 4.2.5
- 4.2.4
- 4.2.3
- 4.2.2
- 4.2.1
- 4.2.0
- 4.1.0
- 4.0.1
- 4.0.0
- 3.5.8
- 3.5.7
- 3.5.6
- 3.5.5
- 3.5.4
- 3.5.3
- 3.5.2
- 3.5.1
- 3.5.0
- 3.4.0
- 3.3.4
- 3.3.3
- 3.3.2
- 3.3.1
- 3.3.0
- 3.2.4
- 3.2.3
- 3.2.2
- 3.2.1
- 3.2.0
- 3.1.1
- 3.1.0
- 3.0.3
- 3.0.2
- 3.0.1
- 3.0.0
- 2.7.3
- 2.7.2
- 2.7.1
- 2.7.0
- 2.6.5
- 2.6.4
- 2.6.3
- 2.6.2
- 2.6.1
- 2.6.0
- 2.5.2
- 2.5.1
- 2.5.0
- 2.4.1
- 2.4.0
- 2.3.3
- 2.3.2
- 2.3.1
- 2.3.0
- 2.2.3
- 2.2.2
- 2.2.1
- 2.2.0
- 2.1.0
- 2.0.2
- 2.0.1
- 2.0.0
- 1.1.1
- 1.1.0
- 1.0.x-dev
- 1.0.0
- 0.0.4
- 0.0.3
- 0.0.2
- 0.0.1
- dev-docs/readme-docs-site
- dev-issue-218
- dev-ci/fix-mysql-tests
- dev-pr/170
- dev-pr/104
- dev-feature/diff-connections
- dev-issue-147
- dev-issue-134
- dev-php-81
- dev-php-8.0
- dev-fix-tests
This package is auto-updated.
Last update: 2026-09-23 11:33:56 UTC
README
The Laravel magic you know, now applied to joins
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.
