morrislaptop/symfony-custom-normalizers

Normalizers for common classes around the place

v0.4.0 2021-03-14 21:11 UTC

This package is auto-updated.

Last update: 2021-11-15 11:04:33 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.