1. Go to this page and download the library: Download kain/simplify-amqp 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/ */
use Simplify\AMQP\AMQPClient;
use Simplify\AMQP\AMQPManager;
use Simplify\AMQP\Common\ExchangeCreateOption;
use Simplify\AMQP\Common\ExchangeType;
use Simplify\AMQP\Common\QueueCreateOption;
$client = new AMQPClient('localhost',5672,'guest','guest');
$client->channel(function (AMQPManager $manager) {
$exchangeOption = new ExchangeCreateOption();
$exchangeOption->setType(ExchangeType::DIRECT());
$exchangeOption->setDurable(true);
$manager->exchange('myexchange')->create($exchangeOption);
$queueOption = new QueueCreateOption();
$queueOption->setDurable(true);
$queueOption->setMaxLength(3000);
$queueOption->setMaxLengthBytes(1024*64);
$queue = $manager->queue('myqueue');
$queue->create($queueOption);
$queue->bind('myexchange','');
});
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.