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

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

webdevcave/dto
==============

Provides a foundation for data transfer objects in PHP applications. Built with support for ArrayAccess, JsonSerializable interfaces and hydration provided by our dependency injection container.

v1.0.1(1mo ago)022↓50%MITPHPPHP &gt;=8.4.1

Since May 6Pushed 1mo agoCompare

[ Source](https://github.com/WebdevCave/dto-php)[ Packagist](https://packagist.org/packages/webdevcave/dto)[ RSS](/packages/webdevcave-dto/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (2)Dependencies (3)Versions (3)Used By (0)

Webdevcave DTO
==============

[](#webdevcave-dto)

Provides a foundation for data transfer objects in PHP applications. Built with support for `ArrayAccess`, `JsonSerializable` interfaces and hydration provided by our dependency injection container (`webdevcave/yadic`).

Requirements
------------

[](#requirements)

- PHP &gt;= 8.4.1
- [Composer](https://getcomposer.org/)

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

[](#installation)

Using composer:

```
composer require webdevcave/dto
```

Usage example
-------------

[](#usage-example)

Extend the `DataTransferObject` class and define your properties. You can use the `from()` method to hydrate the DTO from an array.

```
use Webdevcave\DTO\DataTransferObject;

class UserDTO extends DataTransferObject
{
    public function __construct(
        public readonly string $name,  // Use 'readonly' for strictness.
        public readonly string $email,
    ) {}
}

// Hydrating from array
$data = ['name' => 'John Doe', 'email' => 'john@example.com'];
$user = UserDTO::from($data);

echo $user->name; // John Doe

// ArrayAccess
echo $user['email']; // john@example.com

// JSON Serialization
echo json_encode($user);
```

Scripts
-------

[](#scripts)

The following scripts are available via Composer:

- `composer test`: Run the tests
- `composer test-coverage`: Run the tests with coverage (requires Xdebug)
- `composer check-coverage`: Check the coverage (run test-coverage first)

Tests
-----

[](#tests)

The project uses PHPUnit for testing. You can run the tests using:

```
composer test
```

Contributing
------------

[](#contributing)

Contributions are welcome! If you find any issues or have suggestions for improvements, please open an issue or a pull request on GitHub.

License
-------

[](#license)

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

###  Health Score

43

—

FairBetter than 89% of packages

Maintenance94

Actively maintained with recent releases

Popularity9

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity52

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 ~1 days

Total

2

Last Release

32d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5069326?v=4)[Carlos Alberto Bertholdo Carucce](/maintainers/carloscarucce)[@carloscarucce](https://github.com/carloscarucce)

---

Top Contributors

[![carloscarucce](https://avatars.githubusercontent.com/u/5069326?v=4)](https://github.com/carloscarucce "carloscarucce (8 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[matriphe/iso-639

PHP library to convert ISO-639-1 code to language name.

503.5M8](/packages/matriphe-iso-639)[doctormckay/steamid

PHP SteamID Manipulation

1163.9k](/packages/doctormckay-steamid)[artem_c/emmet

emmet implementation for php

141.8k](/packages/artem-c-emmet)

PHPackages © 2026

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