sigbits / php-amqp-client-bundle
Thin Symfony bundle for configuring sigbits/php-amqp-client connection factories.
Package info
github.com/sigbits/php-amqp-client-bundle
Type:symfony-bundle
pkg:composer/sigbits/php-amqp-client-bundle
Requires
- php: ^8.3
- sigbits/php-amqp-client: ^1.0
- symfony/config: ^6.4 || ^7.4 || ^8.1
- symfony/dependency-injection: ^6.4 || ^7.4 || ^8.1
- symfony/http-kernel: ^6.4 || ^7.4 || ^8.1
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.64
- phpstan/phpstan: ^2.1
- phpunit/phpunit: ^11.5
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Symfony bundle for sigbits/php-amqp-client.
This project is in early development. It currently provides a thin Dependency Injection and configuration layer for AMQP client connection factories.
See docs/roadmap.md for planned milestones and docs/configuration.md for the full configuration reference. Production lifecycle guidance is in docs/operations.md, and release steps are in docs/releasing.md. Public bundle contracts are documented in docs/public-api.md.
Scope
This bundle does not provide Symfony Messenger integration yet. It currently
provides connection configuration, connection factory services, and health-check
services for sigbits/php-amqp-client.
Installation
Install the bundle with Composer:
composer require sigbits/php-amqp-client-bundle:^0.5
If Symfony Flex does not register the bundle automatically, add it manually:
<?php return [ Sigbits\AmqpBundle\SigbitsAmqpBundle::class => ['all' => true], ];
Create config/packages/sigbits_amqp.yaml and configure at least one
connection:
sigbits_amqp: connections: default: uri: '%env(AMQP_URL)%'
Configuration
The bundle registers AMQP connection factories. Fetching a factory from the
container does not open a network connection; the AMQP connection is opened
only when application code calls connect().
# config/packages/sigbits_amqp.yaml sigbits_amqp: default_connection: default connections: default: uri: '%env(AMQP_URL)%' container_id: 'orders-api' timeout: 10.0
Inject the default factory by type:
<?php use Sigbits\AmqpBundle\Connection\ConnectionFactoryInterface; final readonly class OrderPublisher { public function __construct( private ConnectionFactoryInterface $connectionFactory, ) { } public function publish(string $payload): void { $connection = $this->connectionFactory->connect(); $session = $connection->beginSession(); $sender = $session->openSender('/queues/orders'); $sender->send($payload); $sender->detach(); $session->end(); $connection->close(); } }
Named factories are available through predictable service IDs:
sigbits_amqp: default_connection: default connections: default: uri: '%env(AMQP_URL)%' analytics: uri: '%env(AMQP_ANALYTICS_URL)%' tls: peer_name: 'broker.example.com' cafile: '/etc/ssl/certs/broker-ca.pem' sasl: mechanism: plain username: '%env(AMQP_ANALYTICS_USER)%' password: '%env(AMQP_ANALYTICS_PASSWORD)%'
The service ID for the analytics factory is
sigbits_amqp.connection_factory.analytics.
For all options, defaults, TLS/SASL examples, environment-variable examples, and invalid configuration messages, see docs/configuration.md.
Development
Local development commands run inside Docker containers:
make build make install make ci
Use PHP_VERSION to run against a specific supported PHP version:
PHP_VERSION=8.4 make ci PHP_VERSION=8.5 make ci