PHP code example of rxthunder / rabbitmq
1. Go to this page and download the library: Download rxthunder/rabbitmq 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/ */
rxthunder / rabbitmq example snippets
# config/parameters.php
$container->setParameter('rabbit.host', getenv('RABBIT_HOST'));
$container->setParameter('rabbit.port', getenv('RABBIT_PORT'));
$container->setParameter('rabbit.vhost', getenv('RABBIT_VHOST'));
$container->setParameter('rabbit.user', getenv('RABBIT_USER'));
$container->setParameter('rabbit.password', getenv('RABBIT_PASSWORD'));
# config/services.php
use Rxnet\RabbitMq\Client;
use RxThunder\RabbitMQ\Factory;
$asynchRabbitMQDefinition = $container->register(Client::class)
->setFactory([Factory::class, 'createWithVoryxEventLoop'])
->addArgument('%rabbit.host%')
->addArgument('%rabbit.port%')
->addArgument('%rabbit.vhost%')
->addArgument('%rabbit.user%')
->addArgument('%rabbit.password%')
->setPublic(false)
->setAutowired(false)
->setAutoconfigured(true);
# config/services.php
consoles
$consoleDefinition = new Definition();
$consoleDefinition->setPublic(true);
$consoleDefinition->setAutowired(true);
$consoleDefinition->setAutoconfigured(true);
$this->registerClasses($consoleDefinition, 'RxThunder\\RabbitMQ\\Console\\', '../vendor/rxthunder/rabbitmq/src/Console/*');
# config/services.php
'/../vendor/rxthunder/rabbitmq/config/consoles.php';
php vendor/bin/thunder