morrislaptop / symfony-custom-normalizers
Normalizers for common classes around the place
Fund package maintenance!
morrislaptop
Installs: 234 010
Dependents: 1
Suggesters: 0
Security: 0
Stars: 2
Watchers: 2
Forks: 1
Open Issues: 1
Requires
- php: ^7.4|^8.0
- symfony/serializer: ^5.2|^6.0
Requires (Dev)
- brick/date-time: ^0.2.3
- brick/money: ^0.5.1
- friendsofphp/php-cs-fixer: ^2.17
- illuminate/queue: ^8.32
- moneyphp/money: ^3.3
- nesbot/carbon: ^2.46
- phpunit/phpunit: ^9.5
- spatie/ray: ^1.10
- symfony/property-access: ^5.2|^6.0
- vimeo/psalm: ^4.3
- wmde/email-address: ^1.0
README
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 aparse($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.