rosamarsky / jms-carbon-handler
简单易用的JMS Serializer Carbon处理器
2.0
2018-10-12 22:48 UTC
Requires
Requires (Dev)
- phpunit/phpunit: ^4.8|^5.0
This package is auto-updated.
Last update: 2024-09-27 09:30:31 UTC
README
简单易用的JMS Serializer Carbon处理器
安装
composer require rosamarsky/jms-carbon-handler
设置
通过构建对象注册Carbon处理器
$builder->configureHandlers(function (HandlerRegistry $registry) { $registry->registerSubscribingHandler(new CarbonHandler); });
使用方法
作为注解使用
class SomeClass { /** * @Type("Carbon<'Y-m-d'>") */ public $date; }
作为YAML使用
date: type: Carbon<'d-m-Y'>
作为XML使用
<property name="date" xml-attribute="true" type="Carbon"/>