jakubkulhan / bunny

Performant pure-PHP AMQP (RabbitMQ) sync/async (ReactPHP) library
MIT License
698 stars 101 forks source link

Add support for setting client properties #150

Closed jeromegamez closed 3 months ago

jeromegamez commented 3 months ago

As a follow-up to #132 , this PR adds support for setting client properties and capabilities, as described in

$connection = [
    'host'              => 'HOSTNAME',
    'vhost'             => 'VHOST',    // The default vhost is /
    'user'              => 'USERNAME', // The default user is guest
    'password'          => 'PASSWORD', // The default password is guest
    'client_properties' => [
        'connection_name' => 'It works!',
    ],
];
Without connection name With connection name
without_connection_name with_connection_name

:octocat:

jeromegamez commented 3 months ago

@WyriHaximus I was thinking about using

$options['client_properties'] ??= [];

instead of

if (!isset($options['client_properties'])) {
    $options['client_properties'] = [];
}

That would be inconsistent with the other checks, though. Is this something I could/should propose in a separate PR?

WyriHaximus commented 3 months ago

@WyriHaximus I was thinking about using

$options['client_properties'] ??= [];

instead of

if (!isset($options['client_properties'])) {
    $options['client_properties'] = [];
}

That would be inconsistent with the other checks, though. Is this something I could/should propose in a separate PR?

Yes please, I want to make it pass PHPStan at max level before release 0.6 so all these small improvements would greatly help cleaning up the code :+1: