morrislaptop/symfony-custom-normalizers

Normalizers for common classes around the place

v0.5.0 2022-04-09 17:14 UTC

This package is auto-updated.

Last update: 2024-12-11 01:45:52 UTC


README

Latest Version on Packagist GitHub Tests Action Status Total Downloads

A collection of normalizers that can be used with the Symfony serializer.

Installation

You can install the package via composer:

composer require morrislaptop/symfony-custom-normalizers

Supported Classes

Meta Classes

  • Any class with a __toString() method
  • Any class with a parse($str) method
  • Any class with a __toString() if it has a parse($str) method as well
  • ObjectDocblocksNormalizer which simply extends Symfony's ObjectNormalizer but it supports docblocks as well

Usage

$serializer = new Symfony\Serializer([
    new Morrislaptop\SymfonyCustomNormalizers\MoneyNormalizer(),
    new Morrislaptop\SymfonyCustomNormalizers\DatePeriodNormalizer(),
    ...
])

Plug

Use Laravel? Easily cast your objects using the Symfony serializer with morrislaptop/laravel-popo-caster

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.