Skip to content

v1.4

Compare
Choose a tag to compare
@butschster butschster released this 29 Oct 23:07
· 22 commits to master since this release
  • Added ability to convert objects to payloads. Now you can easily describe how to convert objects to payloads in serializer config and then just use converter.
// config/serializer.phpreturn [
    'handlers' => [
       // ...
    ],
    'mapping' => [
        Money\Token::class => [
            'to' => Microservice\Payloads\Billing\Token::class,
            'attributes' => [
                'amount' => [
                    'type' => \Brick\Math\BigDecimal::class
                ],
            ]
        ],
    ],
],

// Example
$token = new Money\Token(100);

$this->app[\Butschster\Exchanger\Contracts\Serializer\ObjectsMapper::class]->toPayload($token)
  • Added ability manage custom serializer handlers
// config/serializer.php
return [
    'handlers' => [
        \Butschster\Exchanger\Jms\Handlers\CarbonHandler::class,
        \Microservice\Jms\Handlers\BigDecimalHandler::class
    ],
    'mapping' => [
       // ...
    ]
];
  • Fixed couple of problems in serializer