【文件属性】:
文件名称:json:强大的JSON解码器编码器,支持模式验证
文件大小:51KB
文件格式:ZIP
更新时间:2021-04-13 20:43:42
PHP
Webmozart JSON
最新版本:
用于json_encode() / json_decode()的健壮包装器,可跨PHP版本对它们的行为进行规范化,引发有意义的异常并默认情况下支持架构验证。
安装
使用安装软件包:
$ composer require webmozart/json
编码方式
使用将数据编码为JSON:
use Webmozart \ Json \ JsonEncoder ;
$ encoder = new JsonEncoder ();
// Store JSON in string
$ string = $ encoder -> encode ( $ data );
// Store JSON in file
$ encoder -> encodeFile ( $ data , '/path/to/file.json' );
默认情况下, 存储在$s
【文件预览】:
json-master
----src()
--------JsonError.php(2KB)
--------Migration()
--------DecodingFailedException.php(484B)
--------InvalidSchemaException.php(477B)
--------JsonValidator.php(6KB)
--------FileNotFoundException.php(471B)
--------EncodingFailedException.php(483B)
--------ValidationFailedException.php(1KB)
--------IOException.php(482B)
--------Conversion()
--------UriRetriever()
--------Validation()
--------JsonDecoder.php(10KB)
--------Versioning()
--------JsonEncoder.php(18KB)
----phpunit.xml.dist(444B)
----.composer-auth.json(267B)
----res()
--------meta-schema.json(4KB)
----.travis.yml(1KB)
----LICENSE(1KB)
----README.md(15KB)
----.styleci.yml(192B)
----appveyor.yml(1KB)
----tests()
--------Migration()
--------JsonValidatorTest.php(7KB)
--------JsonEncoderTest.php(14KB)
--------JsonDecoderTest.php(11KB)
--------Fixtures()
--------UriRetriever()
--------Validation()
--------Versioning()
----.gitignore(23B)
----CHANGELOG.md(2KB)
----composer.json(911B)