leneko / flattener
(un)flatten php/json data structure
Installs: 6
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:lib
Requires
- php: ^8.3
- mnapoli/silly: ^1.9
Requires (Dev)
- ext-xdebug: *
- phpunit/phpunit: ^11.1
README
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