qolab / ivory-serializer
支持PHP 5.6+的序列化器,支持JSON、XML、YAML和CSV格式
1.0.0
2017-02-27 21:35 UTC
Requires
- php: ^5.6|^7.0
- doctrine/instantiator: ^1.0
- doctrine/lexer: ^1.0
- symfony/options-resolver: ^2.7|^3.0
Requires (Dev)
- ext-dom: *
- ext-json: *
- ext-simplexml: *
- doctrine/annotations: ^1.2
- friendsofphp/php-cs-fixer: ^2.0
- nikic/php-parser: ^1.4
- phpdocumentor/reflection: ^3.0
- phpunit/phpunit: ^5.4
- phpunit/phpunit-mock-objects: ^3.2.3
- psr/cache: ^1.0
- symfony/event-dispatcher: ^2.7|^3.0
- symfony/phpunit-bridge: ^2.7|^3.0
- symfony/property-access: ^2.7|^3.0
- symfony/property-info: ^2.7|^3.0
- symfony/yaml: ^2.7|^3.0
Suggests
- ext-dom: Allow you to use the XML serialization visitor and mapping.
- ext-json: Allow you to use the JSON serialization/deserialization visitors and mapping.
- ext-simplexml: Allow you to use the XML deserialization visitor and mapping.
- doctrine/annotations: Allow you to use the mapping annotations.
- phpdocumentor/reflection: Allow you to parse PHP type more efficiently
- symfony/event-dispatcher: Allow you to use the event dispatching system.
- symfony/property-access: Allow you to use the Symfony accessor/mutator.
- symfony/property-info: Allow you to use the mapping type auto discovery.
- symfony/yaml: Allow you to use the YAML serialization/deserialization visitors and mapping.
This package is auto-updated.
Last update: 2024-09-14 01:14:40 UTC
README
此项目是egeloen/ivory-serializer的分支
概述
Ivory Serializer是一个PHP 5.6+库,允许您使用访问者模式递归地对图中的每个节点进行(反)序列化复杂数据。它支持CSV、JSON、XML和YAML格式。它还支持排除策略(组、最大深度、循环引用、版本等)、命名策略(驼峰式、蛇形、studly caps)、自动/显式映射(反射、注解、XML、YAML、JSON)和其他许多功能...
use Ivory\Serializer\Format; use Ivory\Serializer\Serializer; $stdClass = new \stdClass(); $stdClass->foo = true; $stdClass->bar = ['foo', [123, 432.1]]; $serializer = new Serializer(); echo $serializer->serialize($stdClass, Format::JSON); // {"foo": true,"bar": ["foo", [123, 432.1]]} $deserialize = $serializer->deserialize($json, \stdClass::class, Format::JSON); // $deserialize == $stdClass
文档
测试
该库由PHPUnit完全单元测试,代码覆盖率接近100%。要执行测试套件,请检查travis 配置。
贡献
我们热爱贡献者!Ivory是一个开源项目。如果您想做出贡献,请随时提出PR!您可以参考CONTRIBUTING文件,其中将解释如何设置项目。
许可
Ivory Serializer采用MIT许可。有关完整的版权和许可信息,请参阅随源代码一起分发的LICENSE文件。