Allow to build a JSON string programmatically
<?php
require __DIR__ . '/vendor/autoload.php';
use JsonBuilder\Builder\JsonBuilder;
$jb = new JsonBuilder();
$root = $jb->root('array');
$root
->children()
->string()
->value('Foo')
->end()
->number()
->value(123)
->end()
->end()
->end();
$json = $jb->build()->toJson();
echo $json;
The above code will return
["Foo", 123]
Install the library package with composer:
$ php composer.phar require borisguery/json-builder
Install development dependencies
$ composer install --dev
Run the test suite
$ vendor/bin/phpunit
- Take a look at the list of issues.
- Fork
- Write a test (for either new feature or bug)
- Make a PR
Boris Guéry - guery.b@gmail.com - http://borisguery.com - @borisguery
This library is under the MIT license - see the LICENSE file for details