PHP code example of markenwerk / json-pretty-printer

1. Go to this page and download the library: Download markenwerk/json-pretty-printer 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/ */

    

markenwerk / json-pretty-printer example snippets

{php}  
{php}
use Markenwerk\JsonPrettyPrinter;

$jsonString = json_encode($myObject);
$prettyPrinter = new JsonPrettyPrinter\JsonPrettyPrinter();
$prettyPrinted = $prettyPrinter
	->setIndentationString('  ')
	->prettyPrint($jsonString);