curly_sanders/carbon-normalizer
Normalizes to (and from) Carbon and native DateTime objects
1,267
| Install | |
|---|---|
composer require curly_sanders/carbon-normalizer |
|
| Latest Version: | v0.3.1 |
| License: | MIT |
| Last Updated: | Feb 11, 2025 |
| Links: | GitHub · Packagist |
Maintainer: curlysanders
Carbon+DateTime Normalizer
This is a Normalizer for the Symfony Serializer package that supports normalizing
to and from Carbon, CarbonImmutable, Illuminate\Support\Carbon, DateTime and
DateTimeImmutable.
Usage example
$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
License
The MIT License (MIT). Please see License File for more information.
Related Packages
lastdragon-ru/lara-asp-serializer
Provides a customizable wrapper around the Symfony Serializer Component to use i...
82,609
0