Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rtuin/carbon-normalizer
Normalizes to (and from) Carbon and native DateTime objects
https://github.com/rtuin/carbon-normalizer
carbon component json php serializer symfony symfony-component
Last synced: about 1 month ago
JSON representation
Normalizes to (and from) Carbon and native DateTime objects
- Host: GitHub
- URL: https://github.com/rtuin/carbon-normalizer
- Owner: rtuin
- License: mit
- Created: 2021-11-23T00:22:42.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2023-08-16T12:48:26.000Z (over 1 year ago)
- Last Synced: 2024-09-30T16:04:22.645Z (about 2 months ago)
- Topics: carbon, component, json, php, serializer, symfony, symfony-component
- Language: PHP
- Homepage:
- Size: 7.81 KB
- Stars: 2
- Watchers: 1
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
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
-------------```php
$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](LICENSE) for more information.