PHPackages                             guuzen/resource-composer - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. guuzen/resource-composer

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

guuzen/resource-composer
========================

application side joins implementation

211PHP

Since Mar 8Pushed 4y ago1 watchersCompare

[ Source](https://github.com/Guuzen/resource-composer)[ Packagist](https://packagist.org/packages/guuzen/resource-composer)[ RSS](/packages/guuzen-resource-composer/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependenciesVersions (1)Used By (0)

Overview
--------

[](#overview)

This is a library which goal is to simplify object (**resources** in terms of library) joins from different data sources (databases, APIs, etc).

Inspired by

How to use it
-------------

[](#how-to-use-it)

For example - you have Comment, which is stored in document database:

```
final class Comment
{
    public Author $author;

    public function __construct(
        public string $id,
    )
    {
    }
}
```

And Author, which is stored in relational database:

```
final class Author
{
    public function __construct(
        public string $id,
        public string $commentId,
    )
    {
    }
}
```

Obviously it is not possible to easy join this **resources** from different databases by standard SQL join, but it is possible to do this join on application side (so-called application side joins).

To join Comment with Author you need to write resolver:

```
final class CommentHasAuthor implements ResourceLink
{
    /**
     * Loader implementation (which must make actual calls to storage)
     */
    public function loaderClass(): string
    {
        return AuthorLoader::class;
    }

    /**
     * Extract values from all $comment->id
     * Load linked authors by $author->commentId
     * Write linked authors to respective $comment->author
     */
    public function resolver(): ResourceResolver
    {
        return new OneToOne('id', 'commentId', 'author');
    }

    // specify for which resource this resolver is
    public function resourceClass(): string
    {
        return Comment::class;
    }
}
```

Initialize ResourceComposer instance and load related resources

```
$links = [new CommentHasAuthor(new Storage())];
$composer = ResourceComposer::create($links, new AuthorLoader());
$composer->loadRelated($comments);
```

every Comment will contain related Post

###  Health Score

16

—

LowBetter than 5% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity26

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/65a64e9dbe8e6bb79a6e92a8f383272124133c9ee1cf7858d811205b82ad6c6d?d=identicon)[Guuzen](/maintainers/Guuzen)

---

Top Contributors

[![Guuzen](https://avatars.githubusercontent.com/u/11592018?v=4)](https://github.com/Guuzen "Guuzen (8 commits)")

### Embed Badge

![Health badge](/badges/guuzen-resource-composer/health.svg)

```
[![Health](https://phpackages.com/badges/guuzen-resource-composer/health.svg)](https://phpackages.com/packages/guuzen-resource-composer)
```

###  Alternatives

[webfactor/laravel-backpack-instant-fields

Instant fields to create/edit/delete related entities on the fly in Laravel Backpack

486.9k](/packages/webfactor-laravel-backpack-instant-fields)

PHPackages © 2026

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