
— From boring old arrays to shiny typed objects —
[][link-packagist]
[][link-packagist]
[][link-packagist]
[](https://dashboard.stryker-mutator.io/reports/github.com/CuyZ/Valinor/master)
---
Valinor takes care of the construction and validation of raw inputs (JSON, plain
arrays, etc.) into objects, ensuring a perfectly valid state. It allows the
objects to be used without having to worry about their integrity during the
whole application lifecycle.
The validation system will detect any incorrect value and help the developers by
providing precise and human-readable error messages.
The mapper can handle native PHP types as well as other advanced types supported
by [PHPStan] and [Psalm] like shaped arrays, generics, integer ranges and more.
The library also provides a normalization mechanism that can help transform any
input into a data format (JSON, CSV, …), while preserving the original
structure.
## Installation
```bash
composer require cuyz/valinor
```
**📔 Read more on the [online documentation](https://valinor.cuyz.io)**
## Example
```php
final class Country
{
public function __construct(
/** @var non-empty-string */
public readonly string $name,
/** @var list