cylab/json
Composer 安装命令:
composer require cylab/json
包简介
Encodes, decodes, and validates JSON data.
关键字:
README 文档
README
A library for encoding, decoding, linting, and validating JSON data.
Forked from https://github.com/kherge-php/json
This library provides a simplified interface into existing functionality that
is provided by PHP's json extension, justinrainbow/json-schema, and also
seld/jsonlint. The purpose is to make it easy to use while making it hard
to miss errors.
Usage
<?php
use KHerGe\JSON\JSON;
$json = new JSON();
// Decode JSON values.
$decoded = $json->decode('{"test":123}');
// Decode JSON values in files.
$decoded = $json->decodeFile('/path/to/file.json');
// Encode native values.
$encoded = $json->encode(['test' => 123]);
// Encode native values into files.
$json->encodeFile(['test' => 123], '/path/to/file.json');
// Lint an encoded JSON value.
$json->lint('{"test":}');
// Lint an encoded JSON value in a file.
$json->lintFile('/path/to/file.json');
// Validate a decoded JSON value using a JSON schema.
$json->validate(
$json->decodeFile('/path/to/schema.json'),
$decoded
);
Documentation
The JSONInterface interface is your
best resource. The JSON class you will be using implements this interface
and contains all of the information you will need.
Requirements
- PHP 5.6+
- json
Installation
composer require kherge/json=^2.0
License
This library is released under the MIT and Apache 2.0 licenses.
统计信息
- 总下载量: 975
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-11-12