PHP code example of chimera / serialization-jms
1. Go to this page and download the library: Download chimera/serialization-jms library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
chimera / serialization-jms example snippets
declare(strict_types=1);
namespace MyApp;
use Chimera\ExecuteQuery;
use Chimera\MessageCreator\InputExtractor\AppendGeneratedIdentifier;
use Chimera\MessageCreator\InputExtractor\UseInputData;
use Chimera\MessageCreator\JmsSerializer\ArrayTransformer;
use JMS\Serializer\SerializerBuilder;
// We instantiate it passing a valid JMS serialiser
$messageCreator = new ArrayTransformer(
SerializerBuilder::create()->build(),
new AppendGeneratedIdentifier(new UseInputData())
);
// Then use it on the actions
$action = new ExecuteQuery($queryBus, $messageCreator, MyQuery::class); // considering that $queryBus is a valid instance of `ServiceBus`
$result = $action->fetch($input); // considering that $input is a valid instance of `Input`
var_dump($result);