JSON Builder
Allow to build a JSON string programmatically, (*1)
, (*2)
Table of contents
- Overview
- Installation
- Usage
- Known limitations
- Testing
- Contributing
- Authors
- License
Overview
<?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, (*3)
["Foo", 123]
Installation
Install the library package with composer:, (*4)
$ php composer.phar require borisguery/json-builder
Usage
Known limitations
Testing
Install development dependencies, (*5)
$ composer install --dev
Run the test suite, (*6)
$ vendor/bin/phpunit
Contributing
- Take a look at the list of issues.
- Fork
- Write a test (for either new feature or bug)
- Make a PR
Authors
Boris Guéry - guery.b@gmail.com - http://borisguery.com - @borisguery, (*7)
License
This library is under the MIT license - see the LICENSE file for details, (*8)