curly_sanders /carbon-normalizer
v0.2.0
2023-03-09 13:13 UTC
Requires
- nesbot/carbon: ^2.0
- symfony/property-info: ^5.0 || ^6.0
- symfony/serializer: ^5.0 || ^6.0
Requires (Dev)
- illuminate/support: ^8.0
- phpunit/phpunit: ^10.0
This package is not auto-updated.
Last update: 2023-05-16 07:47:51 UTC
README
这是一个为 Symfony Serializer 软件包提供的标准化器,支持将数据标准化为 Carbon
、CarbonImmutable
、Illuminate\Support\Carbon
、DateTime
和 DateTimeImmutable
。
使用示例
$normalizer = new \Rtuin\Normalizer\CarbonDateTimeNormalizer(); $normalized = $normalizer->normalize(\Carbon\CarbonImmutable::now()); // $normalized is now a string '2019-05-28T07:25:00+02:00' $result = $normalizer->denormalize('2019-05-28T07:25:00+02:00', CarbonImmutable::class); // $result is now a CarbonImmutable instance
许可协议
MIT 许可协议(MIT)。有关更多信息,请参阅 许可文件。