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

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

rekhyt/dto
==========

Use the JSON Schema spec to define Data Transfer Objects (DTOs)

v1.0.0(5y ago)04.8kMITPHPPHP &gt;=5.6

Since Jun 4Pushed 5y agoCompare

[ Source](https://github.com/Rekhyt/dto)[ Packagist](https://packagist.org/packages/rekhyt/dto)[ RSS](/packages/rekhyt-dto/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (3)Versions (2)Used By (0)

Data Transfer Object (DTO)
==========================

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

[![Build Status](https://camo.githubusercontent.com/e9d70ea0adef14e08f8048975f1cd351de398cc82cf240b0e2e5ccd58f2cda95/68747470733a2f2f7472617669732d63692e6f72672f6669726570726f6f66736f636b732f64746f2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/fireproofsocks/dto) [![codecov](https://camo.githubusercontent.com/061bfa5e309d6005eb407505cb9a9a0236c6ad190c4bc4aced431924ec287fc3/68747470733a2f2f636f6465636f762e696f2f67682f6669726570726f6f66736f636b732f64746f2f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/fireproofsocks/dto)

This package provides a quick way to define structured objects (DTOs) using the [JSON Schema](http://json-schema.org/)standard.

A Data Transfer Object (DTO) is an object used to pass typed data between layers in your application, similiar 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).

DTOs are a helpful counterpart to the [Data Accessor Object (DAO)](https://en.wikipedia.org/wiki/Data_access_object) or [Repository](https://bosnadev.com/2015/03/07/using-repository-pattern-in-laravel-5/) patterns.

The functionality is similar to what is offered by the [shape](https://packagist.org/packages/leocavalcante/shape)package.

Example
-------

[](#example)

Define a PHP object using JSON Schema syntax:

```
