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

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

friendsofhyperf/validated-dto
=============================

The Data Transfer Objects with validation for Hyperf.

v3.1.75(5mo ago)1412.9k↓18.8%2MITPHPPHP ^8.1

Since Dec 12Pushed 5mo ago2 watchersCompare

[ Source](https://github.com/friendsofhyperf/validated-dto)[ Packagist](https://packagist.org/packages/friendsofhyperf/validated-dto)[ Fund](https://hdj.me/sponsors/)[ GitHub Sponsors](https://github.com/huangdijia)[ RSS](/packages/friendsofhyperf-validated-dto/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (5)Versions (70)Used By (0)

Validated DTO
=============

[](#validated-dto)

[![Latest Stable Version](https://camo.githubusercontent.com/d483766eacdbb593bcaa43a1dd8e825bd14519f177bb8e3e6b2e7f086b4ecee1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f667269656e64736f666879706572662f76616c6964617465642d64746f)](https://packagist.org/packages/friendsofhyperf/validated-dto)[![Total Downloads](https://camo.githubusercontent.com/63224c31fd0cee40a637f4e0bd8f42d54ed72509e30a9231f744a91ed0e3ec19/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f667269656e64736f666879706572662f76616c6964617465642d64746f)](https://packagist.org/packages/friendsofhyperf/validated-dto)[![License](https://camo.githubusercontent.com/34e4a11f19d0e39567e31f32ef10d88cc2e3cc14a03f5cb271b48895eb838793/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f667269656e64736f666879706572662f76616c6964617465642d64746f)](https://github.com/friendsofhyperf/validated-dto)

The Data Transfer Objects with validation for Hyperf applications. Forked from [laravel-validated-dto](https://github.com/WendellAdriel/laravel-validated-dto)

Documentation
-------------

[](#documentation)

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

[](#installation)

```
composer require friendsofhyperf/validated-dto
```

Generating DTO
--------------

[](#generating-dto)

You can create `DTO` using the `gen:dto` command:

```
php bin/hyperf.php gen:dto UserDTO
```

The `DTO` are going to be created inside `app/DTO`.

Defining Validation Rules
-------------------------

[](#defining-validation-rules)

You can validate data in the same way you validate `Request` data:

```
