Skip to content

Latest commit

 

History

History
57 lines (41 loc) · 631 Bytes

README.md

File metadata and controls

57 lines (41 loc) · 631 Bytes

Flattener

A lib for (un)flatten php data structure and a small cli for apply this on Json input.

Usage

Lib

Basically, Flattener::flatten(...) turn this

<?php

[
  'hello' => [
    'world' => [
      '!', '?'
    ],
    'people' => [
      1, 2.3 
    ],
  ],
  'bye' => null
]

into

<?php 

[
  '.hello.world[0]' => '!',
  '.hello.world[1]' => '?',
  '.hello.people[0]' => 1,
  '.hello.people[1]' => 2.3,
  '.bye' => null,
]

(And Flattener::unflatten(...) will play this backward)

CLI

Get help

bin/json-flatten --help

Dev

Coverage

make coverage