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

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

apfelfrisch/data-transfer-object
================================

0.2.3(5y ago)018.4k↓35.7%[1 issues](https://github.com/Apfelfrisch/data-transfer-object/issues)MITPHPPHP ^8.0

Since May 1Pushed 5y ago1 watchersCompare

[ Source](https://github.com/Apfelfrisch/data-transfer-object)[ Packagist](https://packagist.org/packages/apfelfrisch/data-transfer-object)[ RSS](/packages/apfelfrisch-data-transfer-object/feed)WikiDiscussions main Synced yesterday

READMEChangelog (8)Dependencies (3)Versions (9)Used By (0)

Simple Dto
==========

[](#simple-dto)

[![Unit Test](https://github.com/Apfelfrisch/data-transfer-object/actions/workflows/phpunit.yml/badge.svg)](https://github.com/Apfelfrisch/data-transfer-object/actions/workflows/phpunit.yml/badge.svg)[![Static Analysis](https://github.com/Apfelfrisch/data-transfer-object/actions/workflows/psalm.yml/badge.svg)](https://github.com/Apfelfrisch/data-transfer-object/actions/workflows/psalm.yml/badge.svg)

This package is heavily inspired by [spatie/data-transfer-object](https://github.com/spatie/data-transfer-object). The main difference is that the DataTransferObject doesn't come with a constructor. That makes the Initialization less magical which is nicer for static analysis.

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

[](#installation)

You can install the package via composer:

```
composer require apfelfrisch/data-transfer-object
```

Usage
-----

[](#usage)

Here's what a DTO looks like:

```
use Apfelfrisch\DataTransferObject;
use Apfelfrisch\DataTransferObject\Casters\DateTimeCast;

class MyDTO extends DataTransferObject
{
    public function __construct(
        public int $a,

        public float $b,

        public OtherDTO $otherDTO,

        #[DateTimeCast]
        public DateTime $date,
    ) { }
}
```

You could construct this DTO with Parameter casting like so:

```
$dto = MyDTO::fromArrayWithCast([
    'a' => 1,
    'b' => 2.2,
    'otherDTO' => ['id' => 3],
    'date' => '2021-05-01'
);
```

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity53

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

Every ~2 days

Total

8

Last Release

1872d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/4519207?v=4)[Apfelfrisch](/maintainers/Apfelfrisch)[@Apfelfrisch](https://github.com/Apfelfrisch)

---

Top Contributors

[![Apfelfrisch](https://avatars.githubusercontent.com/u/4519207?v=4)](https://github.com/Apfelfrisch "Apfelfrisch (26 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[stevenay/myanfont

Zawgyi and Unicode Font Detector and Converter

167.8k2](/packages/stevenay-myanfont)

PHPackages © 2026

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