Use AMQPExchange::declareExchange() and AMQPQueue::declareQueue() as the main methods.
(PECL amqp >= Unknown)
AMQPExchange::declare — Declare a new exchange on the broker.
Declare a new exchange on the broker with the given information. If an exchange by that name already exists and the exchange_type and/or flags are specified, the exchange settings will be updated.
If no exchange_type is specified and the exchange does not exist, the exchange type will default to "direct".
The name of the exchange.
The type of the exchange. Can be any of AMQP_EX_TYPE_DIRECT, AMQP_EX_TYPE_FANOUT, AMQP_EX_TYPE_TOPIC or AMQP_EX_TYPE_HEADER.
A bitmask of any of the flags: AMQP_PASSIVE, AMQP_DURABLE, AMQP_AUTODELETE.
Returns TRUE on success or FALSE on failure.
Throws AMQPExchangeException on failure.
Example #1 AMQPExchange::declare() example
/* Create a new connection */
$cnn = new AMQPConnection();
$ex = new AMQPExchange($cnn);
$ex->declare('new_topic_exchange', AMQP_EX_TYPE_DIRECT, AMQP_DURABLE | AMQP_AUTODELETE);