AMQPExchange::declare

Declare a new exchange on the broker.

&reftitle.description; public `int` `AMQPExchange::declare`

Declare a new exchange on the broker.

&reftitle.parameters;

&reftitle.returnvalues;

&return.success;

&reftitle.errors;

Throws `AMQPExchangeException` on failure.

Throws `AMQPChannelException` if the channel is not open.

Throws `AMQPConnectionException` if the connection to the broker was lost.

&reftitle.examples;

### `AMQPExchange::declare` example

    <?php

    /* Create a new connection */
    $cnn = new AMQPConnection();
    $cnn->connect();

    $ch = new AMQPChannel($cnn);

    $ex = new AMQPExchange($ch);
    $ex->setName('new_topic_exchange');
    $ex->setType(AMQP_EX_TYPE_DIRECT);
    $ex->setFlags(AMQP_DURABLE | AMQP_AUTODELETE);
    $ex->declare();

    ?>