PHP code example of odolbeau / amqp-service-provider
1. Go to this page and download the library: Download odolbeau/amqp-service-provider 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/ */
odolbeau / amqp-service-provider example snippets
use Pimple\Container;
use Bab\Provider\AMQPServiceProvider;
// Create a new container
$container = new Container();
// Add some configuration
$container['amqp.options'] = [
'connections' => [
'conn1' => [
'host' => '127.0.0.1',
'port' => 5672,
'login' => 'guest',
'password' => 'guest',
'vhost' => '/',
],
'conn2' => [
'host' => '127.0.0.1',
'port' => 5672,
'login' => 'guest',
'password' => 'guest',
'vhost' => 'another_vhost',
]
]
];
// Register the service provider
$container->register(new AMQPServiceProvider());
// To get a queue
$container['queue.factory']('queueName', 'conn1');
// To get an exchange
$container['exchange.factory']('queueName', 'conn2');
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.