rtuin / carbon-normalizer
将Carbon和本地DateTime对象进行标准化(以及反向操作)
v0.2.0
2023-05-02 22:17 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 auto-updated.
Last update: 2024-09-03 01:27:35 UTC
README
这是一个支持将Carbon、CarbonImmutable、Illuminate\Support\Carbon、DateTime以及DateTimeImmutable进行标准化(以及反向操作)的Symfony Serializer包的标准化器。
使用示例
$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)。更多详细信息请参阅许可证文件。