PHPackages                             grixu/relationship-data-transfer-object - 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. grixu/relationship-data-transfer-object

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

grixu/relationship-data-transfer-object
=======================================

Simple class for wrapping data with relationships. But without those meta-data when dump DTO to Array

2.0.0(5y ago)0690MITPHPPHP ^8.0

Since Jan 27Pushed 5y ago1 watchersCompare

[ Source](https://github.com/grixu/relationship-data-transfer-object)[ Packagist](https://packagist.org/packages/grixu/relationship-data-transfer-object)[ Docs](https://github.com/grixu/relationship-data-transfer-object)[ RSS](/packages/grixu-relationship-data-transfer-object/feed)WikiDiscussions main Synced today

READMEChangelog (7)Dependencies (5)Versions (9)Used By (0)

relationship-data-transfer-object
=================================

[](#relationship-data-transfer-object)

[![Latest Version on Packagist](https://camo.githubusercontent.com/86c385b5f608c9d75b1d41881e197b2c8299d100bab81b6d74f8431e2c149c3c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f67726978752f72656c6174696f6e736869702d646174612d7472616e736665722d6f626a6563742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/grixu/relationship-data-transfer-object)

Simple class for wrapping data with relationships. But without those meta-data when dump DTO to Array

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

[](#installation)

You can install the package via composer:

```
composer require grixu/relationship-data-transfer-object
```

Usage
-----

[](#usage)

```
class YourDto extends RelationshipDataTransferObject
{
    // go forward as with normal DTO from spatie/data-transfer-object
    public string $some;
}

// Let's create one DTO object
$dto = new YourDto([
    'some' => 'data',
    'relationships' => [
        [
            'localModel' => Model::class,
            'foreignModel' => ForeignModel::class,
            'localKey' => 'fk',
            'foreignKey' => 'id',
            'type' => BelongsTo::class,
            'pivot' => [
                'field' => 'extra data'
            ]
        ],
        ...
    ]);

// When you dump DTO to aaray it wouldn't contain relationships field
$dto->toArray();

// But you can still access those data
$dto->relationships;
```

### Testing

[](#testing)

```
composer test
```

### Changelog

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

### Security

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Mateusz Gostański](https://github.com/grixu)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 88.9% 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 ~13 days

Recently: every ~23 days

Total

8

Last Release

1889d ago

Major Versions

1.1.5 → 2.0.02021-04-30

PHP version history (2 changes)1.0.0PHP ^7.4|^8.0

2.0.0PHP ^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/67002661?v=4)[Mateusz Gostański](/maintainers/grixu)[@grixu](https://github.com/grixu)

---

Top Contributors

[![mg-rywal](https://avatars.githubusercontent.com/u/54840559?v=4)](https://github.com/mg-rywal "mg-rywal (8 commits)")[![grixu](https://avatars.githubusercontent.com/u/67002661?v=4)](https://github.com/grixu "grixu (1 commits)")

---

Tags

grixurelationship-data-transfer-object

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/grixu-relationship-data-transfer-object/health.svg)

```
[![Health](https://phpackages.com/badges/grixu-relationship-data-transfer-object/health.svg)](https://phpackages.com/packages/grixu-relationship-data-transfer-object)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[renatomarinho/laravel-page-speed

Laravel Page Speed

2.5k1.7M11](/packages/renatomarinho-laravel-page-speed)[illuminate/pagination

The Illuminate Pagination package.

12234.1M1.0k](/packages/illuminate-pagination)[illuminate/pipeline

The Illuminate Pipeline package.

9349.2M278](/packages/illuminate-pipeline)[illuminate/broadcasting

The Illuminate Broadcasting package.

7127.2M208](/packages/illuminate-broadcasting)[illuminate/redis

The Illuminate Redis package.

8314.6M370](/packages/illuminate-redis)

PHPackages © 2026

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