PHPackages                             jsefton/laravel-resourceable - 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. jsefton/laravel-resourceable

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

jsefton/laravel-resourceable
============================

Create unique resources and relate together without context

1.0.0(5y ago)021MITPHP

Since May 3Pushed 5y ago1 watchersCompare

[ Source](https://github.com/jsefton/laravel-resourceable)[ Packagist](https://packagist.org/packages/jsefton/laravel-resourceable)[ Docs](https://endor.digital)[ RSS](/packages/jsefton-laravel-resourceable/feed)WikiDiscussions main Synced yesterday

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

Laravel Resourceabe
===================

[](#laravel-resourceabe)

This package allows you to load instances of any model by a unique reference. The purpose is to allow dynamic passing around of data without not needing to know the exact model throughout the codebase as it will be stored in the databse attched with its ID.

It also allows creating relationships from a model to any other model without having to define the specific relationship.

Resourceable Trait
------------------

[](#resourceable-trait)

The trait can be attached to any eloquent model and gives access to the below methods which powers resourceable.

### Resource Reference

[](#resource-reference)

This method is how you convert the current instance into a Resourceable string.

The resource reference is used throughout Endor as a way to easily identify the item when passing through different features. The resourceReference is made up of the class name and the ID of the current item. An example of this is:

```
App\Post::204
```

Usage:

```
// If we have an App\Post instance with record ID 204 loaded.
$resource = $post->resourceReference();
// returns App\Post::204
```

### UUID

[](#uuid)

A uuid can be generated to be a simple hash string based on the resource. This uses the `resourceReference` to make it unique. The UUID is available as an attributes against the model:

```
$post->uuid;
```

For some features you might need a uuid for the resource and then group it with additional postfixes. This can be done using the uuid as a function and will return a uuid for the individual resource and the passed in `key`.

```
$postt->uuid('');
```

Resource Class
--------------

[](#resource-class)

### Load

[](#load)

You can call the load method against the main Resource class that will use the unique resourceReference and load the instance of the target class with the data record included.

If we have a model for `App\Post` and a record ID of 1, then we can load that through resource such as:

```
$post = Resource::load('App\Post::1');
// returns an instance of App\Post with record ID 1 loaded.
```

TODO
----

[](#todo)

- Adding in relationship methods into package from split out of core.

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 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

Unknown

Total

1

Last Release

1835d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/41b413127c7499a63bcb5c5ae903bd8961ba29300b6ccbda873e0c4bf06d0a02?d=identicon)[jsefton](/maintainers/jsefton)

---

Top Contributors

[![jsefton](https://avatars.githubusercontent.com/u/4114741?v=4)](https://github.com/jsefton "jsefton (1 commits)")

---

Tags

laraveleloquentresourceRelationships

### Embed Badge

![Health badge](/badges/jsefton-laravel-resourceable/health.svg)

```
[![Health](https://phpackages.com/badges/jsefton-laravel-resourceable/health.svg)](https://phpackages.com/packages/jsefton-laravel-resourceable)
```

###  Alternatives

[anourvalar/eloquent-serialize

Laravel Query Builder (Eloquent) serialization

11320.2M21](/packages/anourvalar-eloquent-serialize)[indexzer0/eloquent-filtering

Powerful eloquent filtering

22425.9k3](/packages/indexzer0-eloquent-filtering)[bavix/laravel-clickhouse

Eloquent model for ClickHouse

72214.1k2](/packages/bavix-laravel-clickhouse)[stayallive/laravel-eloquent-observable

Register Eloquent model event listeners just-in-time directly from the model.

2928.9k7](/packages/stayallive-laravel-eloquent-observable)[moneo/laravel-morphmap

Custom morphMap support for Laravel Framework

521.6k](/packages/moneo-laravel-morphmap)

PHPackages © 2026

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