(PECL amqp >= Unknown)
AMQPConnection::__construct — Create an instance of AMQPConnection
Creates an AMQPConnection instance representing a connection to an AMQP broker.
The credentials is an optional array of credential information for connecting to the AMQP broker.
key | Description | Default value |
---|---|---|
host | The host to connect too
|
amqp.host |
port | Port on the host | amqp.port |
vhost | The virtual host on the host
|
amqp.vhost |
login | The login name to use.
|
amqp.login |
password | Password
|
amqp.password |
All other keys will be ignored.
An AMQPConnection object.
Throws AMQPException exception on parameter parsing failures, and option errors.
Example #1 AMQPConnection::__construct() example
<?php
/* Create a connection using the INI values */
$connection1 = new AMQPConnection();
/* Specifying all keys */
$connection2 = new AMQPConnection(array(
'host' => 'example.host',
'vhost' => '/',
'port' => 5763,
'login' => 'user',
'password' => 'password'
));
?>
Note:
A connection will not be established untill AMQPConnection::connect() is called.