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

ActiveLibrary

codebooth/data-transfer-object
==============================

Data Transfer Object is all about how the data is represented

10PHP

Since Aug 10Pushed 6y agoCompare

[ Source](https://github.com/codebooth/data-transfer-object)[ Packagist](https://packagist.org/packages/codebooth/data-transfer-object)[ RSS](/packages/codebooth-data-transfer-object/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependenciesVersions (1)Used By (0)

Data Transfer Object
====================

[](#data-transfer-object)

[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/9004151eb7e1c710cca542d5f9f815726c87925683cde329bbfcad240501bac4/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f636f6465626f6f74682f646174612d7472616e736665722d6f626a6563742f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/codebooth/data-transfer-object)[![SensioLabsInsight](https://camo.githubusercontent.com/1288f99818501df7e3f843c88801a8ff72f84ed81b182027e61713dd592ba3d5/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f7175616c6974792f672f636f6465626f6f74682f646174612d7472616e736665722d6f626a6563742e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/codebooth/data-transfer-object)[![CodeClimate](https://camo.githubusercontent.com/9907a2e32c975e49cdff0ed12c14d350fe497266be6f4eb484d6a9af8d4973a6/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636c696d6174652f6d61696e7461696e6162696c6974792f636f6465626f6f74682f646174612d7472616e736665722d6f626a6563742e7376673f7374796c653d666c61742d737175617265)](https://codeclimate.com/github/codebooth/data-transfer-object)

A Data Transfer Object (DTO) is an object used to pass data between different layers in your application. It holds no business data, but only the minimum required data to transfer between layers or applications.

The DTOs can help to put your unstructured arrays into a clean structure:

- You clearly see what fields are available, and what type that field is (using IDE you get fully type-hinting/autocomplete to be super quick here).
- You get a clear exception/error on fields that are either unexpected or missing where you want this kind of information – early on instead of somewhere down the line.

Getting Started
---------------

[](#getting-started)

You can install the package via composer:

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

Example
-------

[](#example)

Let's consider the following scenario - you recieve following data from a HTTP POST request:

```
$input = [
    'url' => 'https://github.com',
    'number' => 1234,
    'state' => 'open',
    'title' => 'new-feature',
];
```

A data transfer object of the above entity would look something as shown below:

```
use CodeBooth\DataTransferObject\DataTransferObject;

class ExampleObject extends DataTransferObject
{
    public $url;

    public $number;

    public $state;

    public $title;
}
```

Now the data transfer object could be constructed like this:

```
$object = new ExampleObject($input)

echo $object->url; // outputs 'https://github.com'
echo $object->number; // outputs 1234
echo $object->state; // outputs 'open'
```

License
-------

[](#license)

Copyright (c) 2019 CodeBooth. Released under the [MIT License](LICENSE.md).

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity2

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity36

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/2a1d1df52c22428695a9170f915c96e1f472abee65b3dc79922cae30cd470d6f?d=identicon)[svil4ok](/maintainers/svil4ok)

---

Top Contributors

[![sgpopov](https://avatars.githubusercontent.com/u/1070710?v=4)](https://github.com/sgpopov "sgpopov (3 commits)")

---

Tags

data-transfer-objectdtophp

### Embed Badge

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

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

PHPackages © 2026

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