PHP code example of fontebasso / json-to-toon

1. Go to this page and download the library: Download fontebasso/json-to-toon library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

fontebasso / json-to-toon example snippets




use Fontebasso\JsonToToon\Toon;

ce", "role" => "admin"],
  ["id" => 2, "name" => "Bob", "role" => "user"]
];

$toon = Toon::encode('users', $data);

echo $toon;



use Fontebasso\JsonToToon\Toon;

, "role": "admin"},
  {"id": 2, "name": "Bob", "role": "user"}
]';

$toon = Toon::encode('users', $json);

echo $toon;

$data = [
  'meta' => ['a' => 1, 'b' => 2],
  'tags' => ['x', 'y'],
];

echo Toon::encode('data', $data);