PHPackages                             pendalff/eloquent-joins - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. pendalff/eloquent-joins

ActiveLibrary[Database &amp; ORM](/categories/database)

pendalff/eloquent-joins
=======================

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

0.0.1(9y ago)12.7kGPL-3.0PHPPHP &gt;=5.5.9CI failing

Since Jul 6Pushed 9y ago1 watchersCompare

[ Source](https://github.com/pendalff/eloquent-joins)[ Packagist](https://packagist.org/packages/pendalff/eloquent-joins)[ RSS](/packages/pendalff-eloquent-joins/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (3)Versions (2)Used By (0)

Eloquent Joins
==============

[](#eloquent-joins)

[![StyleCI](https://camo.githubusercontent.com/483680cfb4f2eb427339973c00c587ff84bd0bcb19566920ecd3a5778422c5c3/68747470733a2f2f7374796c6563692e696f2f7265706f732f34353933353935352f736869656c643f7374796c653d666c6174)](https://styleci.io/repos/45935955)[![Build Status](https://camo.githubusercontent.com/ad56077e1e7b7c678364397550f9decb5f5d78a39d9d2633a37be3c4fe6bd832/68747470733a2f2f7472617669732d63692e6f72672f746a62702f656c6f7175656e742d6a6f696e732e737667)](https://travis-ci.org/tjbp/eloquent-joins)[![Total Downloads](https://camo.githubusercontent.com/92de898fdab4679a9e4c42f1af4cc2db3ff96b4418774e220fe3e38e2d36de3c/68747470733a2f2f706f7365722e707567782e6f72672f746a62702f656c6f7175656e742d6a6f696e732f642f746f74616c2e737667)](https://packagist.org/packages/tjbp/eloquent-joins)[![Latest Stable Version](https://camo.githubusercontent.com/a02ebcd49b91b0f7b4850be2fa970cd3a6744af17a6c6cc2cac24c78d35f98f7/68747470733a2f2f706f7365722e707567782e6f72672f746a62702f656c6f7175656e742d6a6f696e732f762f737461626c652e737667)](https://packagist.org/packages/tjbp/eloquent-joins)[![Latest Unstable Version](https://camo.githubusercontent.com/f08b60da5e4954f05f93e492de54d491efdd6dc4eed6a4337ce44e3c3aad7902/68747470733a2f2f706f7365722e707567782e6f72672f746a62702f656c6f7175656e742d6a6f696e732f762f756e737461626c652e737667)](https://packagist.org/packages/tjbp/eloquent-joins)[![License](https://camo.githubusercontent.com/e097c408a183b8e515fe3814a18dbe946823f578198401ff899e25419b7f9415/68747470733a2f2f706f7365722e707567782e6f72672f746a62702f656c6f7175656e742d6a6f696e732f6c6963656e73652e737667)](https://packagist.org/packages/tjbp/eloquent-joins)

This package allows you to simply call `$model->join($relation)` to join a Laravel Eloquent relationship's table on the keys declared by your relationship. Columns will be selected automatically, and the joined records hydrated as models in the resulting collection. Laravel's Eloquent does support joins normally, but internally calls the underlying query builder, thereby expecting the name of a table and keys to join it on as arguments.

Installation
------------

[](#installation)

Eloquent Joins is installable [with Composer via Packagist](https://packagist.org/packages/tjbp/eloquent-joins).

Usage
-----

[](#usage)

### Use trait

[](#use-trait)

Simply use EloquentJoins\\ModelTrait in a model:

```
namespace App;

use EloquentJoins\ModelTrait as EloquentJoinsModelTrait;

class User
{
    use EloquentJoinsModelTrait;

    protected $table = 'users';

    public function orders()
    {
        return $this->hasMany('\App\Order');
    }
}

$users = User::join('orders')->get();
```

In the above example, `$users` will contain a collection of all the User models with a corresponding Order model (since we've performed an inner join). Each corresponding Order model can be found in the `$orders` property on the User model (normally this would contain a collection of models with a matching foreign key).

You can string multiple `join()` calls, as well as use the other types of join normally available on the underlying query object (`joinWhere()`, `leftJoin()`, etc.).

### Licence

[](#licence)

Eloquent Joins is free and gratis software licensed under the [GPL3 licence](https://www.gnu.org/licenses/gpl-3.0). This allows you to use Eloquent Joins for commercial purposes, but any derivative works (adaptations to the code) must also be released under the same licence.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 83.3% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

3594d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7c36b15f01dce750c54e099464af6a6eed321e982c67eb38ca4b6691032fae94?d=identicon)[yapendalff](/maintainers/yapendalff)

---

Top Contributors

[![tjbp](https://avatars.githubusercontent.com/u/2157634?v=4)](https://github.com/tjbp "tjbp (5 commits)")[![pendalff](https://avatars.githubusercontent.com/u/236587?v=4)](https://github.com/pendalff "pendalff (1 commits)")

---

Tags

laraveleloquentjoin

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/pendalff-eloquent-joins/health.svg)

```
[![Health](https://phpackages.com/badges/pendalff-eloquent-joins/health.svg)](https://phpackages.com/packages/pendalff-eloquent-joins)
```

###  Alternatives

[kirschbaum-development/eloquent-power-joins

The Laravel magic applied to joins.

1.6k25.2M34](/packages/kirschbaum-development-eloquent-power-joins)[silber/bouncer

Eloquent roles and abilities.

3.6k4.4M25](/packages/silber-bouncer)[tucker-eric/eloquentfilter

An Eloquent way to filter Eloquent Models

1.8k4.8M26](/packages/tucker-eric-eloquentfilter)[watson/validating

Eloquent model validating trait.

9723.3M46](/packages/watson-validating)[reedware/laravel-relation-joins

Adds the ability to join on a relationship by name.

2121.2M13](/packages/reedware-laravel-relation-joins)[cybercog/laravel-love

Make Laravel Eloquent models reactable with any type of emotions in a minutes!

1.2k302.7k1](/packages/cybercog-laravel-love)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
