PHPackages                             cgi/eloquent - 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. cgi/eloquent

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

cgi/eloquent
============

Extends Laravel Eloquent ORM.

12.x-dev(9mo ago)16.3k↓50%MITPHPPHP &gt;=7.1

Since May 5Pushed 9mo ago1 watchersCompare

[ Source](https://github.com/cgi-cgi/laravel-eloquent)[ Packagist](https://packagist.org/packages/cgi/eloquent)[ Docs](https://github.com/cgi-cgi/laravel-eloquent)[ RSS](/packages/cgi-eloquent/feed)WikiDiscussions 10 Synced 1mo ago

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

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

[](#eloquent-joins)

[![Latest Stable Version](https://camo.githubusercontent.com/882d988b58db3bc9321adaa1642565753afceae61b8e86f870ff0a2cc968db8d/68747470733a2f2f706f7365722e707567782e6f72672f6367692f656c6f7175656e742f762f737461626c65)](https://packagist.org/packages/cgi/eloquent)[![Total Downloads](https://camo.githubusercontent.com/1416dd2c9d068f1db6be12d89bbf0883a34af63a53f50cec6e319f1e7d7c2f9f/68747470733a2f2f706f7365722e707567782e6f72672f6367692f656c6f7175656e742f646f776e6c6f616473)](https://packagist.org/packages/cgi/eloquent)[![Latest Unstable Version](https://camo.githubusercontent.com/d466cdcb5f2042659b0c5bf245e96449d1b174db60a2f1c2ca226f46c41ef15f/68747470733a2f2f706f7365722e707567782e6f72672f6367692f656c6f7175656e742f762f756e737461626c65)](https://packagist.org/packages/cgi/eloquent)[![License](https://camo.githubusercontent.com/72e92d2bcbd18f3970a0f30a714495d9ac0e746262771c5b32745f1b4a7188f4/68747470733a2f2f706f7365722e707567782e6f72672f6367692f656c6f7175656e742f6c6963656e7365)](https://packagist.org/packages/cgi/eloquent)[![Monthly Downloads](https://camo.githubusercontent.com/9b1fe290dd6ec7161aaabc0d2be1c0ebe1ed0b6a79a4ee8a988bdc9993b6bac4/68747470733a2f2f706f7365722e707567782e6f72672f6367692f656c6f7175656e742f642f6d6f6e74686c79)](https://packagist.org/packages/cgi/eloquent)[![Daily Downloads](https://camo.githubusercontent.com/095c6ff309a89c166703978e5b8d70754dd671fe9fb9348fbb2dd462c2e9e143/68747470733a2f2f706f7365722e707567782e6f72672f6367692f656c6f7175656e742f642f6461696c79)](https://packagist.org/packages/cgi/eloquent)[![composer.lock](https://camo.githubusercontent.com/84742b5ee4603a4750e2a45e693b6d305ccb1a093038203bf772972727cb8b53/68747470733a2f2f706f7365722e707567782e6f72672f6367692f656c6f7175656e742f636f6d706f7365726c6f636b)](https://packagist.org/packages/cgi/eloquent)

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/cgi/eloquent).

Usage
-----

[](#usage)

### Use trait

[](#use-trait)

Simply use Llama\\Database\\Eloquent\\ModelTrait in a model:

```
namespace App;

use Llama\Database\Eloquent\ModelTrait;

class User
{
    use ModelTrait;

    protected $table = 'users';

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

$users = \App\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 \[MIT licence\]. 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

38

—

LowBetter than 85% of packages

Maintenance58

Moderate activity, may be stable

Popularity22

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 70.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

Every ~335 days

Recently: every ~517 days

Total

10

Last Release

278d ago

Major Versions

5.8.x-dev → 6.x-dev2019-12-11

6.x-dev → 8.x-dev2021-04-22

8.x-dev → 9.x-dev2022-11-23

9.x-dev → 10.x-dev2024-09-10

10.x-dev → 12.x-dev2025-08-13

PHP version history (2 changes)5.3.x-devPHP &gt;=5.5.9

5.8.x-devPHP &gt;=7.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/5a9379f5bff16e36a93f8e9f33e021b7f19ff249c1c65c88612daa1911e7c151?d=identicon)[cgi](/maintainers/cgi)

---

Top Contributors

[![cgi-cgi](https://avatars.githubusercontent.com/u/1552924?v=4)](https://github.com/cgi-cgi "cgi-cgi (26 commits)")[![xuanhoa88](https://avatars.githubusercontent.com/u/406820?v=4)](https://github.com/xuanhoa88 "xuanhoa88 (11 commits)")

---

Tags

laraveleloquentjoinllamacgi

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  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.3M47](/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)
