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

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

railken/eloquent-instance
=========================

v2.0.0(2y ago)15.2k4MITPHPPHP &gt;=8.1

Since Feb 17Pushed 2y ago1 watchersCompare

[ Source](https://github.com/railken/eloquent-instance)[ Packagist](https://packagist.org/packages/railken/eloquent-instance)[ RSS](/packages/railken-eloquent-instance/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependencies (5)Versions (5)Used By (4)

Eloquent Instance
=================

[](#eloquent-instance)

[![Actions Status](https://github.com/railken/eloquent-instance/workflows/Test/badge.svg)](https://github.com/railken/eloquent-instance/actions)

A simple trait that enables the use of instance of `Model` in your relationships. Why? Because otherwise it would be impossible to relate two models that doesn't exist in the code, but only as instances (e.g. stored in db)

Requirements
------------

[](#requirements)

PHP 7.2 and laravel 5.8

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

[](#installation)

You can install it via [Composer](https://getcomposer.org/) by typing the following command:

```
composer require railken/eloquent-instance
```

Usage
-----

[](#usage)

Simple include `Railken\EloquentInstance\HasRelationships` in your model and start using

```
namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Railken\EloquentInstance\HasRelationships;

class Author extends Model
{
    use HasRelationships;

    public function books()
    {
        $book = new Book();
        $book->setTable('book_custom');

        return $this->hasMany($book);
    }
}
```

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~500 days

Total

4

Last Release

862d ago

Major Versions

v1.0.2 → v2.0.02024-03-27

PHP version history (2 changes)v1.0.0PHP &gt;=7.1

v2.0.0PHP &gt;=8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/ea4a9e56b247008aea4d20bb8a555a9f0cb69d0ac69aa8417b29fc37efa2eb5c?d=identicon)[railken](/maintainers/railken)

---

Top Contributors

[![railken](https://avatars.githubusercontent.com/u/26530231?v=4)](https://github.com/railken "railken (14 commits)")

---

Tags

dynamiceloquentinstancelaravelrelationshipslaraveleloquent-instance

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

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

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

###  Alternatives

[spatie/laravel-medialibrary

Associate files with Eloquent models

6.2k45.4M679](/packages/spatie-laravel-medialibrary)[mongodb/laravel-mongodb

A MongoDB based Eloquent model and Query builder for Laravel

7.1k8.9M106](/packages/mongodb-laravel-mongodb)[kirschbaum-development/eloquent-power-joins

The Laravel magic applied to joins.

1.6k35.7M50](/packages/kirschbaum-development-eloquent-power-joins)[yajra/laravel-oci8

Oracle DB driver for Laravel via OCI8

8793.3M27](/packages/yajra-laravel-oci8)[spatie/laravel-sluggable

Generate slugs when saving Eloquent models

1.6k13.4M341](/packages/spatie-laravel-sluggable)[psalm/plugin-laravel

Psalm plugin for Laravel

3355.4M352](/packages/psalm-plugin-laravel)

PHPackages © 2026

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