PHP code example of crutch / producer
1. Go to this page and download the library: Download crutch/producer 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/ */
crutch / producer example snippets
/** @var Crutch\Producer\Producer $defaultProducer */
/** @var Crutch\Producer\Producer $topicOneProducer */
/** @var Crutch\Producer\Producer $topicTwoProducer */
$producer = new Crutch\Producer\Producers\RouteProducer($defaultProducer);
$producer->setProducer('one', $topicOneProducer);
$producer->setProducer('two', $topicTwoProducer);
$producer->produce('message 1', 'one'); // produced by $topicOneProducer
$producer->produce('message 2', 'two'); // produced by $topicTwoProducer
$producer->produce('message 3', 'three'); // produced by $defaultProducer