PHPackages                             dereuromark/cakephp-dto - 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. dereuromark/cakephp-dto

ActiveCakephp-plugin[Utility &amp; Helpers](/categories/utility)

dereuromark/cakephp-dto
=======================

A CakePHP plugin for generating immutable Data Transfer Objects with full type safety

3.0.0(4w ago)3096.0k↑68.2%63MITPHPPHP &gt;=8.2CI passing

Since Dec 8Pushed 2w ago3 watchersCompare

[ Source](https://github.com/dereuromark/cakephp-dto)[ Packagist](https://packagist.org/packages/dereuromark/cakephp-dto)[ Docs](https://github.com/dereuromark/cakephp-dto/)[ RSS](/packages/dereuromark-cakephp-dto/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (10)Dependencies (21)Versions (60)Used By (3)

CakePHP DTO plugin
==================

[](#cakephp-dto-plugin)

[![CI](https://github.com/dereuromark/cakephp-dto/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/dereuromark/cakephp-dto/actions/workflows/ci.yml?query=branch%3Amaster)[![codecov](https://camo.githubusercontent.com/e9f53d79a53ef73ed6b419b1eed8dcc3f995b09e6b9276015da555f281cdf5c5/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f6465726575726f6d61726b2f63616b657068702d64746f2f6d61737465722e737667)](https://codecov.io/gh/dereuromark/cakephp-dto)[![Latest Stable Version](https://camo.githubusercontent.com/6d0bd571ed36962930fe97d58e4de13e951369a2263c55557ab119e67cd0478e/68747470733a2f2f706f7365722e707567782e6f72672f6465726575726f6d61726b2f63616b657068702d64746f2f762f737461626c652e737667)](https://packagist.org/packages/dereuromark/cakephp-dto)[![Minimum PHP Version](https://camo.githubusercontent.com/ec21f169d70b69344c67d6f18fa1a24d20476d2f0cd680e8c4a1534c22f34e5f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344253230382e322d3838393242462e737667)](https://php.net/)[![License](https://camo.githubusercontent.com/66bc2f39293816e082d8a45b7c82b0c047a50a7158106915c9417d6b87f84851/68747470733a2f2f706f7365722e707567782e6f72672f6465726575726f6d61726b2f63616b657068702d64746f2f6c6963656e73652e737667)](LICENSE)[![Total Downloads](https://camo.githubusercontent.com/864fc661616fb9dc9a58bad7a181896c5ca72aa5d8a1899ca4a1f95365ef4e8f/68747470733a2f2f706f7365722e707567782e6f72672f6465726575726f6d61726b2f63616b657068702d64746f2f642f746f74616c2e737667)](https://packagist.org/packages/dereuromark/cakephp-dto)[![Coding Standards](https://camo.githubusercontent.com/4788bab10b61ca8b0d56334238717a9191fe9cceecb154973f8854146a2bb5a6/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f63732d5053522d2d322d2d522d707572706c652e7376673f7374796c653d666c61742d737175617265)](https://github.com/php-fig-rectified/fig-rectified-standards)

A Data Transfer Object (DTO) is an object used to pass typed data between layers in your application, similar in concept to [Structs](https://en.wikipedia.org/wiki/Struct_(C_programming_language)) in C, Martin Fowler's [Transfer Objects](http://martinfowler.com/eaaCatalog/dataTransferObject.html), or [Value Objects](https://en.wikipedia.org/wiki/Value_object).

The goal of this package is to structure "unstructured data", replacing simple (associative) arrays with a more speaking solution.

**Unique approach:** Unlike other PHP DTO libraries that use runtime reflection, this plugin generates actual PHP code from configuration files. This provides the best possible IDE support, static analysis compatibility, and runtime performance. See [Motivation](https://github.com/php-collective/dto/blob/master/docs/Motivation.md) for a comparison with alternatives.

- By making all fields typeable, we can be sure that their values are never something we didn't expect. Especially with modern PHP and more strict typehinting moving forward this is rather important to detect and fail early.
- We can have full IDE autocomplete and typehinting.
- We can use tools like PHPStan to statically analyze the code (more strictly).
- We can simplify the logic where required fields will now just throw a meaningful exception.
- We can work with different inflections of field names more easily.
- Easy way of immutable DTOs with required fields, to trust them in following code.
- Works out of the box with any [value object](https://github.com/Serhii-DV/awesome-php-value-objects) that is serializable (either as array or string).

This plugin will provide you with a tool to quickly generate custom and optimized DTOs for your special use cases.

CakePHP integration for [php-collective/dto](https://github.com/php-collective/dto).

This branch is for use with **CakePHP 5.1+**. For details see [version map](https://github.com/dereuromark/cakephp-dto/wiki#cakephp-version-map).

Examples
--------

[](#examples)

Live examples in the Sandbox: [Github Demo](https://sandbox.dereuromark.de/sandbox/dto-examples/github).

See [Examples](docs/Examples.md) for basic, immutable, mapper, and complex entity use cases. The generated demo DTOs of those are in [tests/test\_app/src/Dto/](tests/test_app/src/Dto/).

Note: Param/return types are enabled and strict types disabled by default.

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

[](#installation)

You can install this plugin into your CakePHP application using [Composer](https://getcomposer.org/).

```
composer require dereuromark/cakephp-dto

```

Then load the plugin with the following command:

```
bin/cake plugin load CakeDto

```

Usage
-----

[](#usage)

See [Docs](docs/README.md) for details.

###  Health Score

66

—

FairBetter than 99% of packages

Maintenance95

Actively maintained with recent releases

Popularity43

Moderate usage in the ecosystem

Community22

Small or concentrated contributor base

Maturity88

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 96.2% 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 ~52 days

Recently: every ~23 days

Total

53

Last Release

29d ago

Major Versions

0.2.7 → 1.0.0-beta2019-12-29

1.8.0 → 2.0.02023-09-21

1.8.1 → 2.2.22024-10-21

2.9.2 → 3.0.02026-05-11

PHP version history (6 changes)0.1PHP &gt;=5.6

1.0.0-betaPHP &gt;=7.2

1.3.0PHP &gt;=7.3

1.6.0PHP &gt;=7.4

2.0.0PHP &gt;=8.1

2.5.0PHP &gt;=8.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/39854?v=4)[Mark Scherer](/maintainers/dereuromark)[@dereuromark](https://github.com/dereuromark)

---

Top Contributors

[![dereuromark](https://avatars.githubusercontent.com/u/39854?v=4)](https://github.com/dereuromark "dereuromark (400 commits)")[![jorisvaesen](https://avatars.githubusercontent.com/u/4093781?v=4)](https://github.com/jorisvaesen "jorisvaesen (8 commits)")[![asaliev](https://avatars.githubusercontent.com/u/836841?v=4)](https://github.com/asaliev "asaliev (7 commits)")[![saeideng](https://avatars.githubusercontent.com/u/8215801?v=4)](https://github.com/saeideng "saeideng (1 commits)")

---

Tags

data-transfertransfer-objectsplugincakephpdtoimmutablecode-generationtype-safetydata-transfer

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/dereuromark-cakephp-dto/health.svg)

```
[![Health](https://phpackages.com/badges/dereuromark-cakephp-dto/health.svg)](https://phpackages.com/packages/dereuromark-cakephp-dto)
```

###  Alternatives

[dereuromark/cakephp-tools

A CakePHP plugin containing lots of useful and reusable tools

336972.2k49](/packages/dereuromark-cakephp-tools)[cakephp/bake

Bake plugin for CakePHP

11211.7M189](/packages/cakephp-bake)[dereuromark/cakephp-ide-helper

CakePHP IdeHelper Plugin to improve auto-completion

1902.3M39](/packages/dereuromark-cakephp-ide-helper)[dereuromark/cakephp-tinyauth

A CakePHP plugin to handle user authentication and authorization the easy way.

131237.3k12](/packages/dereuromark-cakephp-tinyauth)[dereuromark/cakephp-setup

A CakePHP plugin containing lots of useful management tools

35184.7k2](/packages/dereuromark-cakephp-setup)[cakedc/tiny-mce

TinyMCE Plugin for CakePHP

10790.7k](/packages/cakedc-tiny-mce)

PHPackages © 2026

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