PHPackages                             simonisme/array-to-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. [Utility &amp; Helpers](/categories/utility)
4. /
5. simonisme/array-to-dto

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

simonisme/array-to-dto
======================

2.0.2(8y ago)111MITPHPPHP &gt;=7.1.0

Since Aug 26Pushed 8y ago1 watchersCompare

[ Source](https://github.com/SimonIsMe/array-to-dto)[ Packagist](https://packagist.org/packages/simonisme/array-to-dto)[ Docs](https://github.com/SimonIsMe/array-to-dto)[ RSS](/packages/simonisme-array-to-dto/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (4)Dependencies (1)Versions (3)Used By (0)

json-to-dto
===========

[](#json-to-dto)

This is simple library to convert array to specified value object classes.

Example
-------

[](#example)

### Simple object

[](#simple-object)

```
class EmailAddress
{
	public $email;

	public function __construct(string $email)
	{
		$this->email = $email;
	}

}

$arrayToDtoParse = new ArrayToDtoParser();
$result  = $arrayToDtoParse->parseToDto(EmailAddress::class, [
    'address@domain.com';
]);

//  $result variable contains correct EmailAddress object
echo $result->email; // address@domain.com
```

### Nested object

[](#nested-object)

```
class User
{
	public $emailAddress;
	public $number;
	public $birthDate;

	public function __construct(EmailAddress $emailAddress, string $name, \DateTime $birthDate)
	{
		$this->emailAddress = $emailAddress;
		$this->number = $name;
		$this->birthDate = $birthDate;
	}
}

class Nested
{
	public $user;
	public $emailAddress;

	public function __construct(User $user, EmailAddress $emailAddress)
	{
		$this->user = $user;
		$this->emailAddress = $emailAddress;
	}
}

class EmailAddress
{
	public $email;

	public function __construct(string $email)
	{
		$this->email = $email;
	}
}

class Dto
{
	public $user;
	public $nested;

	public function __construct(User $user, Nested $nested)
	{
		$this->user = $user;
		$this->nested = $nested;
	}
}

$arrayToDtoParse = new ArrayToDtoParser();
$result  = $arrayToDtoParse->parseToDto(Dto::class, [
    'user' => [
        'emailAddress' => 'address@domain.com',
        'name' => 'Simon',
        'birthDate' => '1991-01-02',
    ],
    'nested' => [
        'user' => [
            'emailAddress' => 'address2@domain.com',
            'name' => 'Simon',
            'birthDate' => '1991-01-02',
        ],
        'emailAddress' => 'address3@domain.com'
    ]
]);
```

For more examples please look into /tests directory.

Important
---------

[](#important)

Keys in the array and constructor's parameters have to have the same names!

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

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

Total

2

Last Release

3223d ago

Major Versions

1.0.0 → 2.0.22017-09-03

### Community

Maintainers

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

---

Top Contributors

[![SimonIsMe](https://avatars.githubusercontent.com/u/750530?v=4)](https://github.com/SimonIsMe "SimonIsMe (14 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/simonisme-array-to-dto/health.svg)

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

PHPackages © 2026

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