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)124891[2 issues](https://github.com/Micro-PHP/dto/issues)1MITPHPPHP &gt;= 8.0

Since May 11Pushed 3mo ago1 watchersCompare

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

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

39

—

LowBetter than 84% of packages

Maintenance50

Moderate activity, may be stable

Popularity20

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

726d 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.3k17.9M388](/packages/easycorp-easyadmin-bundle)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.5k5.9M736](/packages/sylius-sylius)[api-platform/core

Build a fully-featured hypermedia or GraphQL API in minutes!

2.6k51.2M338](/packages/api-platform-core)[oro/platform

Business Application Platform (BAP)

645143.5k115](/packages/oro-platform)[shopware/platform

The Shopware e-commerce core

3.4k1.5M3](/packages/shopware-platform)[web-auth/webauthn-framework

FIDO2/Webauthn library for PHP and Symfony Bundle.

515100.5k3](/packages/web-auth-webauthn-framework)

PHPackages © 2026

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