PHPackages                             azavyalov/json-mapper - 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. azavyalov/json-mapper

ActiveLibrary

azavyalov/json-mapper
=====================

0.2.0(8mo ago)037↓100%MITPHPPHP ^8.3

Since Aug 17Pushed 8mo agoCompare

[ Source](https://github.com/AlexMordred/json-mapper)[ Packagist](https://packagist.org/packages/azavyalov/json-mapper)[ RSS](/packages/azavyalov-json-mapper/feed)WikiDiscussions master Synced 1mo ago

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

This package maps PHP arrays to strictly-typed objects. You can convert arrays to Data Transfer Objects (DTO), Value Objects (VO), validate API JSON responses, or basically instantiate any classes with arrays. Inspired by Go/Rust/Zig/... structs and was born out of a necesity to validate 3rd-party API JSON responses.

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

[](#installation)

```
composer require azavyalov/json-mapper

```

Usage
-----

[](#usage)

### Example

[](#example)

Below is a working example demonstrating most of the features (read the comments in the code too). Please read the following sections to have a better idea of what is and what is not allowed.

```
