rabbitmq-tutorials/php
2023-10-19 20:46:38 +03:00
..
.gitignore Ignore composer.phar 2017-03-15 19:30:47 +03:00
composer.json fix: improve php library tutorial 2023-10-19 20:46:38 +03:00
emit_log_direct.php Add more missing closing tags, references #198 2019-01-04 21:19:31 +03:00
emit_log_topic.php adding close tag 2019-01-04 11:28:32 -06:00
emit_log.php Add more missing closing tags, references #198 2019-01-04 21:19:31 +03:00
new_task.php Add more missing closing tags, references #198 2019-01-04 21:19:31 +03:00
README.md fix: improve php library tutorial 2023-10-19 20:46:38 +03:00
receive_logs_direct.php fix: improve php library tutorial 2023-10-19 20:46:38 +03:00
receive_logs_topic.php fix: improve php library tutorial 2023-10-19 20:46:38 +03:00
receive_logs.php fix: improve php library tutorial 2023-10-19 20:46:38 +03:00
receive.php fix: improve php library tutorial 2023-10-19 20:46:38 +03:00
rpc_client.php fix: improve php library tutorial 2023-10-19 20:46:38 +03:00
rpc_server.php fix: improve php library tutorial 2023-10-19 20:46:38 +03:00
send.php update send.php 2019-01-03 09:17:33 -06:00
worker.php fix: improve php library tutorial 2023-10-19 20:46:38 +03: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 7.2+

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

sudo apt-get install git-core php-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:

php composer.phar install

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

php 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