arokettu/json5-builder
最新稳定版本:2.2.1
Composer 安装命令:
composer require arokettu/json5-builder
包简介
JSON5 config builder/encoder
README 文档
README
A tool to generate human-friendly JSON5 files. The tool aims to generate new files, not modifying existing ones. However, it can prettify a raw JSON a bit.
For parsing please use other tools like colinodell/json5.
The tool also supports emitting JSON and JSONC with a subset of available features.
Installation
composer require arokettu/json5-builder
Usage
<?php use Arokettu\Json5\Json5Encoder; use Arokettu\Json5\Values\CommentDecorator; use Arokettu\Json5\Values\HexInteger; require __DIR__ . '/../vendor/autoload.php'; $config = new CommentDecorator( [ 'bareKeys' => '<- Look, no quotes!', 'value' => new CommentDecorator( new HexInteger(0xFFF), commentAfter: 'This is a very important value' ), 'notAvailableInJSON' => [NAN, INF], 'end' => 'auto trailing comma ->' ], commentBefore: 'This is my cool JSON5 config!', ); echo Json5Encoder::encode($config);
will result in
// This is my cool JSON5 config! { bareKeys: "<- Look, no quotes!", value: 0xFFF, // This is a very important value notAvailableInJSON: [ NaN, Infinity, ], end: "auto trailing comma ->", }
Documentation
Read the full documentation here: https://sandfox.dev/php/json5-builder.html
Also on Read the Docs: https://json5-builder.readthedocs.io/
Support
Please file issues on our main repo at GitLab: https://gitlab.com/sandfox/json5-builder/-/issues
Feel free to ask any questions in our room on Gitter: https://gitter.im/arokettu/community
License
The library is available as open source under the terms of the MIT License.
统计信息
- 总下载量: 242
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-04-26