PHPackages                             micro/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. [Validation &amp; Sanitization](/categories/validation)
4. /
5. micro/dto

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

micro/dto
=========

Library for generating and validation DTO classes.

v1.6.2(3y ago)124881[2 issues](https://github.com/Micro-PHP/dto/issues)1MITPHPPHP &gt;= 8.0

Since May 11Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/Micro-PHP/dto)[ Packagist](https://packagist.org/packages/micro/dto)[ RSS](/packages/micro-dto/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (6)Dependencies (13)Versions (18)Used By (1)

DTO Generator
=============

[](#dto-generator)

PHP library for generating DTO classes.

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

[](#installation)

Use the package manager [composer](https://getcomposer.org/) to install micro/dto.

```
composer require micro/dto
```

Usage
-----

[](#usage)

#### Declare all required classes in the XML Schemea

[](#declare-all-required-classes-in-the-xml-schemea)

- example.xml
- See the full list of possible options in the [XSD schema](src/Resource/schema/dto-1.6.xsd)

```

```

- And run generator

```
$classGenerator = new \Micro\Library\DTO\ClassGeneratorFacadeDefault(
    ['./example.xml'],    // List of class declaration files
    './out',              // Path to the folder where to generate
    'Transfer'            // Suffix for the all DTO classes (optional)
);
$classGenerator->generate();

// Usage example
$user = new \User\UserTransfer();
$user
    ->setAge(19)
    ->setEmail('demo@micro-php.net');
// OR
//
$user['age'] = 19;
$user['email'] = 'demo@micro-php.net';

// Validation example
$validator = new \Micro\Library\DTO\ValidatorFacadeDefault();
$validator->validate($user); // Validation groups by default ["Default"]
$validator->validate($user, ['patch', 'put']); // Set validation groups ["patch", "put"]

// Serialize example
$serializer = new \Micro\Library\DTO\SerializerFacadeDefault();
$serializer->toArray($user); // Simple array
$serializer->toJson($user); // Simple Json

// Deserialize example
$serialized = $serializer->toJsonTransfer($user);
$deserialized = $serializer->fromJsonTransfer($serialized);
```

### [See full example](./example/)

[](#see-full-example)

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

[](#contributing)

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License
-------

[](#license)

[MIT](https://choosealicense.com/licenses/mit/)

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance55

Moderate activity, may be stable

Popularity21

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 98.3% 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 ~65 days

Recently: every ~126 days

Total

13

Last Release

681d ago

Major Versions

0.1.2 → 1.6.0.x-dev2023-02-15

v1.6.2 → 2.x-dev2024-07-06

PHP version history (3 changes)0.1PHP &gt;= 8.0

1.6.0.x-devPHP &gt;= 8.1

2.x-devPHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/4942d7cf647e76c9a857f6d8ebb7197c1822999b2d696eb682adf464339eedc7?d=identicon)[Stanislau.Komar](/maintainers/Stanislau.Komar)

---

Top Contributors

[![Asisyas](https://avatars.githubusercontent.com/u/2931180?v=4)](https://github.com/Asisyas "Asisyas (59 commits)")[![tchudeska](https://avatars.githubusercontent.com/u/57593077?v=4)](https://github.com/tchudeska "tchudeska (1 commits)")

---

Tags

dtodto-generatordto-patternmicrophpmicrodatageneratorobjectdata-transfer-objectdtotransferdata-transfer

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Psalm

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k16.7M310](/packages/easycorp-easyadmin-bundle)[wendelladriel/laravel-validated-dto

Data Transfer Objects with validation for Laravel applications

759569.4k13](/packages/wendelladriel-laravel-validated-dto)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.2M386](/packages/shopware-core)[form-manager/form-manager

PHP-HTML form manager

16041.0k7](/packages/form-manager-form-manager)[yorcreative/laravel-argonaut-dto

Argonaut is a lightweight Data Transfer Object (DTO) package for Laravel that supports nested casting, recursive serialization, and validation out of the box. Ideal for service layers, APIs, and clean architecture workflows.

1062.8k1](/packages/yorcreative-laravel-argonaut-dto)[sfmok/request-input-bundle

Converts request data into DTO inputs objects with validation.

3512.8k](/packages/sfmok-request-input-bundle)

PHPackages © 2026

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