rabbitmq-tutorials/php
Jason Marquette 7e766f55b2
Update receive.php
Adding close tag.
2019-01-03 09:13:22 -06:00
..
.gitignore Ignore composer.phar 2017-03-15 19:30:47 +03:00
composer.json Allow for more recent 2.6.x versions 2017-04-03 00:02:53 +03:00
emit_log_direct.php Clean up inconsistent echo statements in PHP 2018-05-28 16:36:48 -04:00
emit_log_topic.php Clean up inconsistent echo statements in PHP 2018-05-28 16:36:48 -04:00
emit_log.php Clean up inconsistent echo statements in PHP 2018-05-28 16:36:48 -04:00
new_task.php Clean up inconsistent echo statements in PHP 2018-05-28 16:36:48 -04:00
README.md Added require example 2018-12-11 18:06:19 +02:00
receive_logs_direct.php Clean up inconsistent echo statements in PHP 2018-05-28 16:36:48 -04:00
receive_logs_topic.php Clean up inconsistent echo statements in PHP 2018-05-28 16:36:48 -04:00
receive_logs.php Clean up inconsistent echo statements in PHP 2018-05-28 16:36:48 -04:00
receive.php Update receive.php 2019-01-03 09:13:22 -06:00
rpc_client.php Clean up inconsistent echo statements in PHP 2018-05-28 16:36:48 -04:00
rpc_server.php Clean up inconsistent echo statements in PHP 2018-05-28 16:36:48 -04:00
send.php PHP Tutorial sources conform to PSR-2 standard 2018-05-28 16:31:12 -04:00
worker.php Clean up inconsistent echo statements in PHP 2018-05-28 16:36:48 -04:00

PHP code for RabbitMQ tutorials

Here you can find PHP code examples from RabbitMQ tutorials.

To successfully use the examples you will need a running RabbitMQ server.

Requirements

PHP 5.3+

You need PHP 5.3 and php-amqplib. To get these dependencies on Ubuntu type:

sudo apt-get install git-core php5-cli

Composer

Then install Composer per instructions on their site.

Client Library

Then you can install php-amqplib using Composer.

To do that install Composer and add it to your path, then run the following command inside this project folder:

composer.phar install

Or you can require it to the existing project using a command:

composer.phar require php-amqplib/php-amqplib

Code

Tutorial one: "Hello World!":

php send.php
php receive.php

Tutorial two: Work Queues:

php new_task.php "A very hard task which takes two seconds.."
php worker.php

Tutorial three: Publish/Subscribe

php receive_logs.php
php emit_log.php "info: This is the log message"

Tutorial four: Routing:

php receive_logs_direct.php info
php emit_log_direct.php info "The message"

Tutorial five: Topics:

php receive_logs_topic.php "*.rabbit"
php emit_log_topic.php red.rabbit Hello

Tutorial six: RPC:

php rpc_server.php
php rpc_client.php