ivory / serializer
1.0.4
2021-01-06 23:55 UTC
Requires
- php: >=7.0
- doctrine/instantiator: ^1.0
- doctrine/lexer: ^1.0
- symfony/options-resolver: ^4.3 || ^5.0
Requires (Dev)
- ext-dom: *
- ext-json: *
- ext-simplexml: *
- doctrine/annotations: ^1.2 || ^1.3
- friendsofphp/php-cs-fixer: ^2.0
- mockery/mockery: ^1.3 || ^1.4
- phpdocumentor/reflection: ^3.0 || ^4.0
- phpunit/phpunit: ^6.5 || ^7.5 || ^8.5 || ^9.5
- psr/cache: ^1.0
- symfony/event-dispatcher: ^3.0 || ^4.3 || ^5.2
- symfony/phpunit-bridge: ^3.0 || ^4.3 || ^5.2
- symfony/property-access: ^3.0 || ^4.3 || ^5.2
- symfony/property-info: ^3.0 || ^4.3 || ^5.2
- symfony/yaml: ^3.0 || ^4.3 || ^5.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.
Replaces
- egeloen/serializer: ^1.0.0
This package is auto-updated.
Last update: 2024-03-01 18:27:56 UTC
README
概览
Ivory 序列化器是一个 PHP ^7.0 库,允许您使用访问者模式递归地在图的每个节点上(反)序列化复杂数据。它支持 CSV、JSON、XML 和 YAML 格式。它还支持诸如排除策略(分组、最大深度、循环引用、版本等)、命名策略(驼峰式、蛇形、大写)、自动/显式映射(反射、注解、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 序列化器采用 MIT 许可证。有关完整的版权和许可信息,请阅读与此源代码一起分发的 LICENSE 文件。