Skip to content
github-actions[bot] edited this page Oct 5, 2026 · 2 revisions

Dalue

Dalue maps nested arrays, objects and JSON documents into a new structure described by a plain PHP array (the schema). It is built on uuur86/strobj, which reads the source data with slash-separated paths.

use Dalue\Mapper;
use StrObj\StringObjects;

$data = StringObjects::instance('{"user":{"id":7,"name":"Jane"}}');

$result = Mapper::map($data, [
    'id'     => '@data/user/id',
    'name'   => '@data/user/name',
    'source' => 'api',
]);
// ['id' => 7, 'name' => 'Jane', 'source' => 'api']

Pages

Clone this wiki locally