krak/money-normalizer

Symfony Normalizer/Denormalizer for moneyphp/money

v1.0.1 2023-03-01 13:55 UTC

This package is auto-updated.

Last update: 2024-11-29 17:26:04 UTC


README

This contains a Symfony Denormalizer for the moneyphp/money Money\Money class.

Installation

Install with composer at krak/money-normalizer.

Usage

MoneyDenormalizer

$denormalizer = new Krak\MoneyNormalizer\MoneyDenormalizer();
$money = $denormalizer->denormalize(['amount' => 10, 'currency' => 'USD'], 'Money\Money');

Symfony Integration

Register the MoneyNormalizerBundle in your kernel in config/bundles.php:

<?php

return [
  //...
  Krak\MoneyNormalizer\Bridge\Symfony\MoneyNormalizerBundle::class => ['all' => true],
];