1. Go to this page and download the library: Download sandermuller/json 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/ */
sandermuller / json example snippets
use SanderMuller\Json\Json;
Json::encode(['name' => 'hihaho']); // '{"name":"hihaho"}'
Json::pretty(['name' => 'hihaho']); // indented, slashes and unicode left alone
Json::array('{"a":1}'); // array<array-key, mixed> (object or array)
Json::list('["a","b"]'); // list<mixed> (array only)
Json::object('{"a":1}'); // stdClass (object only)
Json::string('"hi"'); // string
Json::int('42'); // int
Json::float('4.2'); // float (ints are widened)
Json::bool('true'); // bool
Json::decode($raw); // mixed (when the shape is genuinely unknown)
Json::arrayOrNull('"hi"'); // null
Json::objectOrNull('[1,2]'); // null
Json::arrayOrNull('{'); // still throws: malformed input is bad data, not a shape