PHPackages                             isakzhanov-r/laravel-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. isakzhanov-r/laravel-dto

ActiveLibrary

isakzhanov-r/laravel-dto
========================

Data Transfer Object for VO

v1.2.6(5mo ago)12.3k↓33.3%1MITPHPPHP ^8.0|^8.2

Since Sep 15Pushed 5mo ago1 watchersCompare

[ Source](https://github.com/isakzhanov-r/laravel-dto)[ Packagist](https://packagist.org/packages/isakzhanov-r/laravel-dto)[ RSS](/packages/isakzhanov-r-laravel-dto/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (6)Versions (15)Used By (0)

Laravel Data Transfer Object
============================

[](#laravel-data-transfer-object)

> Allows you to pass data in the specified typing, namely in `IsakzhanovR\ValueObject` or in a primitive type. The same type can be a DTO

 [![Total Downloads](https://camo.githubusercontent.com/5adc4cd104d388e1f6f6e58c2a39ca89d2e05e2c06948b8f714db9f6c2a44f7f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6973616b7a68616e6f762d722f6c61726176656c2d64746f2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/isakzhanov-r/laravel-dto) [![Latest Stable Version](https://camo.githubusercontent.com/6671ee62b6a5741dad5160c2a200f6dce1f6795ab3b7267f5c72fa634865bbeb/68747470733a2f2f706f7365722e707567782e6f72672f6973616b7a68616e6f762d722f6c61726176656c2d64746f2f762f737461626c653f666f726d61743d666c61742d737175617265)](https://packagist.org/packages/isakzhanov-r/laravel-dto) [![Latest Unstable Version](https://camo.githubusercontent.com/a33b37d2ee7c81f0e068d69af60d28ff882aa0e869124ada5698692615b23f62/68747470733a2f2f706f7365722e707567782e6f72672f6973616b7a68616e6f762d722f6c61726176656c2d64746f2f762f756e737461626c653f666f726d61743d666c61742d737175617265)](https://packagist.org/isakzhanov-r/laravel-dto) [![License](https://camo.githubusercontent.com/25698d069013d852c4efa3dbc6ad254061728a6b2fb3ab6d60e95d5400b0b67e/68747470733a2f2f706f7365722e707567782e6f72672f6973616b7a68616e6f762d722f6c61726176656c2d64746f2f6c6963656e73653f666f726d61743d666c61742d737175617265)](LICENSE)

Contents
--------

[](#contents)

- [Installation](#installation)
- [Usage](#usage)
- [License](#license)

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

[](#installation)

To get the latest version of Laravel Data Transfer Object package, simply require the project using [Composer](https://getcomposer.org):

```
$ composer require isakzhanov-r/laravel-dto
```

Instead, you can, of course, manually update the dependency block `require` in `composer.json` and run `composer update` if you want to:

```
{
    "require-dev": {
        "isakzhanov-r/laravel-dto": "^1.0"
    }
}
```

Usage
-----

[](#usage)

To use `DTO`, you need to create a class that will inherit from the abstract DataTransferObject class, and declare the public variables in the class with the desired type

```
use IsakzhanovR\DataTransferObject\DataTransferObject;
use IsakzhanovR\ValueObject\Email  // example

class UserData extends DataTransferObject
{
    public $id;

    public string $name;

    /**
    * @var \IsakzhanovR\ValueObject\Email
    * @throws \App\Exceptions\EmailDataExeption
    */
    public Email $email;

    /**
    * @var IsakzhanovR\DataTransferObject\FiledDTO[] - example
    */
    public array $fields;
}
```

You can also create a DTO object from an array, from a FormRequest, from an Object and from a JSON string

```
$dto = new UserData(['id' => 1,'name' => 'Example',' email' => 'example@test.com']);

$array = ['id' => 1,'name' => 'Example',' email' => 'example@test.com'];

$dto = UserData::fromArray($array);

$object = new stdClass();
$object->id = 1;
$object->name = 'Example';
$object->email = 'example@test.com';

$dto = UserData::fromObject($object);

$dto = UserData::fromRequest($request);

$dto = UserData::fromJson(json_encode($array));
```

It also happens that you need to reverse transformation into an array , for this there is a `get` method:

```
$dto->get()
```

or a method with recursive transformation into an array

```
$dto->toArray()
```

License
-------

[](#license)

This package is released under the [MIT License](LICENSE).

###  Health Score

46

—

FairBetter than 93% of packages

Maintenance70

Regular maintenance activity

Popularity21

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity70

Established project with proven stability

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

Recently: every ~219 days

Total

14

Last Release

168d ago

PHP version history (2 changes)v1.0.0PHP ^7.4|^8.0

v1.2.6PHP ^8.0|^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/a3fd6aab3f44bd9e13bdcb29861643956862d786211d8ed2d5630217569fc232?d=identicon)[isakzhanovR](/maintainers/isakzhanovR)

---

Top Contributors

[![isakzhanov-r](https://avatars.githubusercontent.com/u/38492287?v=4)](https://github.com/isakzhanov-r "isakzhanov-r (11 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/isakzhanov-r-laravel-dto/health.svg)

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

###  Alternatives

[laravel/ui

Laravel UI utilities and presets.

2.7k134.9M601](/packages/laravel-ui)[spatie/laravel-honeypot

Preventing spam submitted through forms

1.6k6.0M60](/packages/spatie-laravel-honeypot)[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

74310.9M66](/packages/laravel-mcp)[watson/validating

Eloquent model validating trait.

9723.3M47](/packages/watson-validating)[proengsoft/laravel-jsvalidation

Validate forms transparently with Javascript reusing your Laravel Validation Rules, Messages, and FormRequest

1.1k2.3M49](/packages/proengsoft-laravel-jsvalidation)[yajra/laravel-oci8

Oracle DB driver for Laravel via OCI8

8703.0M17](/packages/yajra-laravel-oci8)

PHPackages © 2026

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