php-amqplib/php-amqplib
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|---|---|---|---|---|
phpseclib/phpseclib | 3.0.37 | - | MIT | prod |
The php-amqplib/php-amqplib library is a powerful tool for PHP developers, offering a pure PHP implementation of the AMQP 0-9-1 protocol. This library has been extensively tested against RabbitMQ. The AMQP Protocol, which stands for Advanced Message Queuing Protocol, allows for faster and more reliable cross-platform messaging between applications. Using php-amqplib/php-amqplib, developers can effectively communicate with RabbitMQ servers right from their PHP applications.
To use php-amqplib/php-amqplib, you first need to install it using composer. In your terminal, run the command:
$ composer require php-amqplib/php-amqplib
This command will retrieve the library and its dependencies into your vendor
folder. You then need to include the autoload.php
file in your script:
require_once __DIR__.'/vendor/autoload.php';
You should then use the classes relevant to your application:
use PhpAmqpLib\Connection\AMQPStreamConnection;
use PhpAmqpLib\Message\AMQPMessage;
To look at an example of a publisher and a consumer, consider the following:
On your first terminal, start the consumer:
$ cd php-amqplib/demo
$ php amqp_consumer.php
On your second terminal, run:
$ cd php-amqplib/demo
$ php amqp_publisher.php some text to publish
You should see the message arrive at the process on the first terminal.
Comprehensive documentation for php-amqplib/php-amqplib is conveniently available online. You can access the API Documentation at http://php-amqplib.github.io/php-amqplib/. Additionally, you can learn more about the usage of this library from the official RabbitMQ tutorials.