Home

Awesome

CakePHP DTO plugin

CI codecov Latest Stable Version Minimum PHP Version License Total Downloads Coding Standards

A Data Transfer Object (DTO) is an object used to pass typed data between layers in your application, similar in concept to Structs in C, Martin Fowler's Transfer Objects, or Value Objects.

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

For more see Motivation and Background.

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

This branch is for use with CakePHP 5.0+. For details see version map.

Examples

Live examples in the Sandbox: Github Demo.

See Examples for basic, immutable and complex entity use cases. The generated demo DTOs of those are in tests/test_app/src/Dto/.

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

Installation

You can install this plugin into your CakePHP application using Composer.

composer require dereuromark/cakephp-dto

Then load the plugin with the following command:

bin/cake plugin load CakeDto

Usage

See Docs for details.