guanguans/json-format

v1.1.2 2020-09-24 08:33 UTC

This package is auto-updated.

Last update: 2024-10-24 17:19:36 UTC


README

Format json string.

Build Status Build Status Scrutinizer Code Quality codecov StyleCI Total Downloads Latest Stable Version License

Requirements

  • PHP > 5.4
  • ext-json

Installing

$ composer require guanguans/json-format -v

Usage

Code

<?php
require __DIR__.'/vendor/autoload.php';

$json = <<<'JSON'
{"name":"json-format","keywords":["json","format","pretty"],"description":"Format json string."}
JSON;

echo json_format($json);

Output

{
    "name": "json-format",
    "keywords": [
        "json",
        "format",
        "pretty"
    ],
    "description": "Format json string."
}

Testing

$ composer test

License

MIT