Download the PHP package vu/zf2-amqp-carapace without Composer
On this page you can find all versions of the php package vu/zf2-amqp-carapace. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download vu/zf2-amqp-carapace
More information about vu/zf2-amqp-carapace
Files in vu/zf2-amqp-carapace
Package zf2-amqp-carapace
Short Description ZF2 PHP Wrapper for Vu/AMQPCarapace
License BSD-3-Clause
Informations about the package zf2-amqp-carapace
Zf2AMQPCarapace
Introduction
Zf2AMQPCarapace is a wrapper for "vuhl/AMQPCarapace" which makes using AMQP in PHP extremely simple. Please refer to examples below to see this for yourself.
Important Notes
- Zf2AMQPCarapace currently only has publish capabilities. Consuming and other abilities may be added in the future.
- Mandatory flag on a message is not currently supported. You should keep this flag as false otherwise an exception will be thrown.
Installation Using Composer
Add "vu/zf2-amqp-carapace" to the require section of your composer.json file and run a respective install or update. For more information on Composer, please visit their website.
Basic Usage
Setup Configuration
Inside one of your Zf2 config files, add basic configuration for your connection, transport, message, and application. You can have any number of settings for each category.
- Connection: Settings related to creating an AMQP connection
- Transport: Defines exchange-specific settings such as what exchange to hit, routing keys, and more
- Message: Basic predefined message settings
- Application: Predefined connection, transport, and message settings for a specific application. This uses settings you have already defined for connection, transport, and message.
Example:
Creating an AMQPPublisher
The easiest way to publish a message is to use the PublisherFactory. The main purpose of the PublisherFactory is to use predefined settings from the 'application' section of your configuration in order to create an AMQPPublisher. You may, though, pass in custom settings to create an AMQPPublisher as well. Example:
Using AMQPPublisher
Once you have an AMQPPublisher setup, you will easily be able to publish messages to whatever exchange you have defined. The AMQPPublisher will take care of creating and closing AMQP channels for you.
Chaining the PublisherFactory and AMQPPublisher
The PublisherFactory and AMQPPublisher can be chained together.
Using the Connection, Transport, and Message Factories
The Connection, Transport, and Message factories all implement the IFactory interface which specifies two methods - create and createFromArray. They will return a respective AMQPCarapace Connection, Transport, or Message object.
-
create - creates from predefined configuration as noted above. Example:
- createFromArray - creates from configuration passed in as an array. Example:
AMQPCarapace
For more information on the standalone AMQPCarapace, please view the vuhl\AMQPCarapace page
All versions of zf2-amqp-carapace with dependencies
vu/amqp-carapace Version 0.1.0
zendframework/zend-servicemanager Version 2.*
zendframework/zend-stdlib Version 2.*
vu/zf2-test-extensions Version 1.0