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

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

wendelladriel/laravel-validated-dto
===================================

Data Transfer Objects with validation for Laravel applications

v4.7.0(1mo ago)762649.9k↓24.3%46[1 issues](https://github.com/WendellAdriel/laravel-validated-dto/issues)12MITPHPPHP ^8.2CI passing

Since Dec 9Pushed 1mo ago3 watchersCompare

[ Source](https://github.com/WendellAdriel/laravel-validated-dto)[ Packagist](https://packagist.org/packages/wendelladriel/laravel-validated-dto)[ Fund](https://www.paypal.me/wendelladriel)[ GitHub Sponsors](https://github.com/WendellAdriel)[ RSS](/packages/wendelladriel-laravel-validated-dto/feed)WikiDiscussions main Synced 3d ago

READMEChangelog (10)Dependencies (30)Versions (62)Used By (12)

 [![Validated DTO for Laravel](https://github.com/wendelladriel/laravel-validated-dto/raw/main/art/laravel-validated-dto-banner.png)](https://github.com/wendelladriel/laravel-validated-dto/raw/main/art/laravel-validated-dto-banner.png)Validated DTO for Laravel
=========================

[](#validated-dto-for-laravel)

 Data Transfer Objects with validation for Laravel applications

 [![Packagist](https://camo.githubusercontent.com/27e4fc22e55b26fb8fc21d2ca49c307e9cbbe11166e642dbebca7814407c9eaa/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f77656e64656c6c61647269656c2f6c61726176656c2d76616c6964617465642d64746f2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/wendelladriel/laravel-validated-dto) [![PHP from Packagist](https://camo.githubusercontent.com/499370d03319e50f502ae8e5806a7cacd48d89b250f7c2e7f63ec5d4120b1dcb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f77656e64656c6c61647269656c2f6c61726176656c2d76616c6964617465642d64746f2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/wendelladriel/laravel-validated-dto) [![Laravel versions](https://camo.githubusercontent.com/97e14c9121fdc543a8795f1889678ffb77d611a63bb503dbe2a1ab0d3ae68fbf/68747470733a2f2f62616467652e6c61726176656c2e636c6f75642f62616467652f77656e64656c6c61647269656c2f6c61726176656c2d76616c6964617465642d64746f3f7374796c653d666c6174)](https://packagist.org/packages/wendelladriel/laravel-validated-dto) [![GitHub Workflow Status (main)](https://camo.githubusercontent.com/dd0821324c0bf05f17fa45428ab27fdf981e1a7475ee87f863150860996d1f53/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f77656e64656c6c61647269656c2f6c61726176656c2d76616c6964617465642d64746f2f74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d5465737473267374796c653d666c61742d737175617265)](https://github.com/wendelladriel/laravel-validated-dto/actions) [![Total Downloads](https://camo.githubusercontent.com/d7c05bf4d7177a05c5cc79565af9b5db74f7911685ba3b8efddf9c13cd11dd96/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f77656e64656c6c61647269656c2f6c61726176656c2d76616c6964617465642d64746f2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/wendelladriel/laravel-validated-dto)

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

[](#installation)

You can install the package via composer:

```
composer require wendelladriel/laravel-validated-dto
```

You can publish the config file with:

```
php artisan vendor:publish --tag="validated-dto"
```

Usage
-----

[](#usage)

Create a DTO by extending `ValidatedDTO`, declaring typed properties, and defining the validation rules for incoming data:

```
use Illuminate\Validation\Rules\Password;
use WendellAdriel\ValidatedDTO\Casting\BooleanCast;
use WendellAdriel\ValidatedDTO\Casting\StringCast;
use WendellAdriel\ValidatedDTO\ValidatedDTO;

final class UserDTO extends ValidatedDTO
{
    public string $name;

    public string $email;

    public string $password;

    public bool $active;

    protected function rules(): array
    {
        return [
            'name' => ['required', 'string'],
            'email' => ['required', 'email'],
            'password' => ['required', Password::min(8)],
            'active' => ['sometimes', 'boolean'],
        ];
    }

    protected function defaults(): array
    {
        return [
            'active' => true,
        ];
    }

    protected function casts(): array
    {
        return [
            'name' => new StringCast(),
            'email' => new StringCast(),
            'password' => new StringCast(),
            'active' => new BooleanCast(),
        ];
    }
}
```

Create an instance from an array, request, JSON string, Eloquent model, or artisan command:

```
$dto = UserDTO::fromArray([
    'name' => 'John Doe',
    'email' => 'john.doe@example.com',
    'password' => 's3CreT!@1a2B',
]);

$dto->name; // John Doe
$dto->toArray();
```

You can also inject a DTO into a controller action and let the service container resolve it from the current request:

```
use Illuminate\Http\JsonResponse;

final class StoreUserController
{
    public function __invoke(UserDTO $dto): JsonResponse
    {
        return response()->json($dto->toArray());
    }
}
```

Access the full documentation [here](https://laravel-validated-dto.wendelladriel.com).

Changelog
---------

[](#changelog)

Please see the [changelog](https://laravel-validated-dto.wendelladriel.com/getting-started/changelog) for more information on what has changed recently.

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

[](#contributing)

Thank you for considering contributing to Validated DTO for Laravel! You can read the contribution guide [here](CONTRIBUTING.md).

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](.github/SECURITY.md) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Wendell Adriel](https://github.com/WendellAdriel)
- [All Contributors](../../contributors)

License
-------

[](#license)

Validated DTO for Laravel is open-sourced software licensed under the [MIT license](LICENSE).

###  Health Score

68

—

FairBetter than 99% of packages

Maintenance92

Actively maintained with recent releases

Popularity60

Solid adoption and visibility

Community37

Small or concentrated contributor base

Maturity73

Established project with proven stability

 Bus Factor1

Top contributor holds 75.7% 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 ~21 days

Recently: every ~40 days

Total

59

Last Release

39d ago

Major Versions

v1.1.2 → v2.0.02022-12-14

v2.11.1 → v3.0.02023-09-06

3.x-dev → v4.0.02025-02-26

PHP version history (3 changes)v1.0.0PHP ^8.0

v3.0.0PHP ^8.1

v4.0.0PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/565cea386dcfc4df5188a338113624866e65e4b31b209a7a99bb6c4c272e8731?d=identicon)[wendell\_adriel](/maintainers/wendell_adriel)

---

Top Contributors

[![WendellAdriel](https://avatars.githubusercontent.com/u/11641518?v=4)](https://github.com/WendellAdriel "WendellAdriel (178 commits)")[![dansysanalyst](https://avatars.githubusercontent.com/u/79267265?v=4)](https://github.com/dansysanalyst "dansysanalyst (7 commits)")[![benbjurstrom](https://avatars.githubusercontent.com/u/12499093?v=4)](https://github.com/benbjurstrom "benbjurstrom (7 commits)")[![emrancu](https://avatars.githubusercontent.com/u/11002290?v=4)](https://github.com/emrancu "emrancu (7 commits)")[![felixbessler](https://avatars.githubusercontent.com/u/65896926?v=4)](https://github.com/felixbessler "felixbessler (6 commits)")[![bnzo](https://avatars.githubusercontent.com/u/17174973?v=4)](https://github.com/bnzo "bnzo (5 commits)")[![UendelC](https://avatars.githubusercontent.com/u/21681869?v=4)](https://github.com/UendelC "UendelC (5 commits)")[![DavoodGhanbarpour](https://avatars.githubusercontent.com/u/57192665?v=4)](https://github.com/DavoodGhanbarpour "DavoodGhanbarpour (5 commits)")[![patriziotomato](https://avatars.githubusercontent.com/u/544502?v=4)](https://github.com/patriziotomato "patriziotomato (2 commits)")[![vadymtsots](https://avatars.githubusercontent.com/u/73906449?v=4)](https://github.com/vadymtsots "vadymtsots (2 commits)")[![mark-rady-intcore](https://avatars.githubusercontent.com/u/91468983?v=4)](https://github.com/mark-rady-intcore "mark-rady-intcore (1 commits)")[![MasterFelX](https://avatars.githubusercontent.com/u/35193620?v=4)](https://github.com/MasterFelX "MasterFelX (1 commits)")[![peterfox](https://avatars.githubusercontent.com/u/1716506?v=4)](https://github.com/peterfox "peterfox (1 commits)")[![ricazao](https://avatars.githubusercontent.com/u/7110502?v=4)](https://github.com/ricazao "ricazao (1 commits)")[![scottzirkel](https://avatars.githubusercontent.com/u/1329131?v=4)](https://github.com/scottzirkel "scottzirkel (1 commits)")[![serogaq](https://avatars.githubusercontent.com/u/36307024?v=4)](https://github.com/serogaq "serogaq (1 commits)")[![simon-tma](https://avatars.githubusercontent.com/u/37322653?v=4)](https://github.com/simon-tma "simon-tma (1 commits)")[![IDTitanium](https://avatars.githubusercontent.com/u/34219909?v=4)](https://github.com/IDTitanium "IDTitanium (1 commits)")[![ljxheihei](https://avatars.githubusercontent.com/u/138198598?v=4)](https://github.com/ljxheihei "ljxheihei (1 commits)")[![jeffwhansen](https://avatars.githubusercontent.com/u/2449767?v=4)](https://github.com/jeffwhansen "jeffwhansen (1 commits)")

---

Tags

data-transfer-objectdtolaravelvalidationlaravelvalidationdata-transfer-objectdto

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/wendelladriel-laravel-validated-dto/health.svg)

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

###  Alternatives

[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

77022.3M151](/packages/laravel-mcp)[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9762.4M131](/packages/roots-acorn)[mike-bronner/laravel-model-caching

Automatic caching for Eloquent models.

2.4k91.9k1](/packages/mike-bronner-laravel-model-caching)[api-platform/laravel

API Platform support for Laravel

58171.6k14](/packages/api-platform-laravel)[sandermuller/laravel-fluent-validation

Fluent validation rule builders for Laravel

20719.0k4](/packages/sandermuller-laravel-fluent-validation)

PHPackages © 2026

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