rosamarsky / jms-carbon-handler
Simple to use Carbon handler for the JMS Serializer
Installs: 50 657
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Open Issues: 0
Requires
Requires (Dev)
- phpunit/phpunit: ^4.8|^5.0
This package is auto-updated.
Last update: 2024-10-27 09:35:24 UTC
README
Simple to use Carbon handler for JMS Serializer
Installation
composer require rosamarsky/jms-carbon-handler
Setup
Register the Carbon Handler via the builder object:
$builder->configureHandlers(function (HandlerRegistry $registry) { $registry->registerSubscribingHandler(new CarbonHandler); });
Usage
As annotations:
class SomeClass { /** * @Type("Carbon<'Y-m-d'>") */ public $date; }
As YAML:
date: type: Carbon<'d-m-Y'>
As XML:
<property name="date" xml-attribute="true" type="Carbon"/>