Hatch provides a set of simple tools for generating PHP code.
Get news and updates on the DecodeLabs blog.
Install via Composer:
composer require decodelabs/hatch
Export arrays of data for reuse as config files or static loadable datastructures.
use DecodeLabs\Hatch;
$code = Hatch::exportStaticArray([
'foo' => 'bar',
'baz' => 'qux',
'quux' => [
'corge' => 'grault',
'garply' => 12,
'fred' => [
'plugh' => 'xyzzy',
'thud' => [1, 2, 3]
]
]
]);
echo $code;
This will output:
[
'foo' => 'bar',
'baz' => 'qux',
'quux' => [
'corge' => 'grault',
'garply' => 12,
'fred' => [
'plugh' => 'xyzzy',
'thud' => [1, 2, 3]
]
]
]
Hatch is licensed under the MIT License. See LICENSE for the full license text.