https://github.com/zircote/amqp
AMQP -- This is experimental only and not intended for production use at this time, If this is a concern, look elsewhere.
https://github.com/zircote/amqp
Last synced: about 1 year ago
JSON representation
AMQP -- This is experimental only and not intended for production use at this time, If this is a concern, look elsewhere.
- Host: GitHub
- URL: https://github.com/zircote/amqp
- Owner: zircote
- License: lgpl-2.1
- Created: 2012-07-15T17:06:24.000Z (almost 14 years ago)
- Default Branch: master
- Last Pushed: 2013-05-20T19:46:28.000Z (about 13 years ago)
- Last Synced: 2025-03-23T19:45:04.430Z (over 1 year ago)
- Language: PHP
- Homepage:
- Size: 5.09 MB
- Stars: 2
- Watchers: 2
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# AMQP #
[](http://travis-ci.org/zircote/AMQP)
Setup
=============
__git__
`git clone git://github.com/zircote/AMQP.git`
__composer__
```json
{
"require": [
"zircote/amqp": "master-dev"
]
}
```
`composer install`
Usage
======
host is defined by passing a URN string as first connection parameter:
`amqp://user:pass@hostname:port/vhost`
`amqps://user:pass@hostname:port/vhost`
connection options are passed as the second parameter of the connection:
```php
false,
'login_method' => \AMQP\Connection::AMQP_AUTH_PLAIN,
'login_response' => null,
'locale' => 'en_US',
'connection_timeout' => 3,
'read_write_timeout' => 3,
'context' => null,
'ssl_options' => array()
);
$connection = new \AMQP\Connection($amqp, $options);
```
With RabbitMQ running open two Terminals and on the first one execute the following commands to start the consumer:
$ cd php-amqplib/demo
$ php amqp_consumer.php
Then on the other Terminal do:
$ cd php-amqplib/demo
$ php amqp_publisher.php some text to publish
You should see the message arriving to the process on the other Terminal
Then to stop the consumer, send to it the `quit` message:
$ php amqp_publisher.php quit
If you need to listen to the sockets used to connect to RabbitMQ then see the example in the non blocking consumer.
$ php amqp_consumer_non_blocking.php
## More Examples ##
- `amqp_ha_consumer.php`: demoes the use of mirrored queues
- `amqp_consumer_exclusive.php` and `amqp_publisher_exclusive.php`: demoes fanout exchanges using exclusive queues.
- `amqp_consumer_fanout_{1,2}.php` and `amqp_publisher_fanout.php`: demoes fanout exchanges with named queues.
- `basic_get.php`: demoes obtaining messages from the queues by using the _basic get_ AMQP call.
## Loading Classes ##
$ ant setup
Place the following in your bootstrap once composer has been installed in the project:
```php
```
## Benchmarks ##
To run the publishing/consume benchmark type:
$ ant benchmark
## Tests ##
Once your environment is set up you can run your tests like this:
$ ant build
History
============
This project is a work in progress and derived from work begun by [php-amqplib](https://github.com/tnc/php-amqplib).
It attempts to achieve a cleaner, more friendly use-case by updating the API, documentation and php 5.3 compatibility.
Because there was no desire to perform these changes in the related projects due to outdating books and publication, it
was my deciscion to fork and begin this work.
For more information on its history please see this project.