Skip to content

makhnanov/php-json-pretty-view

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHP JSON Pretty View

PHP JSON Pretty View

Requirements

"php": "^8.3",
"illuminate/support": "^12.0"

Installation

composer require makhnanov/php-json-pretty-view

Usage

<?php

use Makhnanov\JsonPrettyView\PrettyJson;

require_once __DIR__ . '/vendor/autoload.php';

$asString = <<<JSON
{
    "id": 1000,
    "true": true,
    "false": false,
    "null": null,
    "string": "null",
    "second string": "str sub str",
    "array": [
        1,
        2
    ],
    "last string": "finish"
}
JSON;

json_pretty($asString);

// OR

pretty_json($asString);

// OR

echo PrettyJson::highlightCli([
    'id' => 1000,
    'true' => true,
    'false' => false,
    'null' => null,
    'string' => "null",
    'second string' => "str sub str",
    'array' => [
        1, 2,
    ],
    'last string' => "finish",
]);

echo PHP_EOL;

About

PHP Json Pretty View

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages