andrewmy/rabbitmq-management-api
PHP 7.1+/8 wrapper for the RabbitMQ Management HTTP API. Provides an object-oriented client for queues, exchanges, publish, and more, using PHP-HTTP/HTTPlug so you can plug in any compatible HTTP client (e.g., Guzzle adapter).
psr/http-message, psr/http-factory), ensuring compatibility with Laravel’s ecosystem (e.g., HTTP clients like Guzzle).php-http/guzzle7-adapter or similar, adding dependency complexity.Illuminate\Support\Facades\Http) via PSR-18/PSR-17 adapters (e.g., php-http/guzzle7-adapter).Illuminate\Queue\Connectors\RabbitMQConnector) for cross-cutting management (e.g., monitoring, dynamic queue creation).php-http stack (client, discovery, PSR factories), adding ~10MB to vendor size.php-amqplib/php-amqplib (AMQP protocol) or vladimir-yuldashev/rabbitmq for missing functionality (e.g., consumer management).queue:work) for dynamic queue monitoring?php-amqplib entirely, or is it supplementary?Http facade with the package’s Client class.$this->app->singleton(RabbitMq\ManagementApi\Client::class, function ($app) {
return new Client($app['http.client']);
});
php artisan rabbitmq:purge-queue).Client::queues()->get() instead of file_get_contents($rabbitmq_api_url).symfony/http-client (v8) may conflict with Laravel’s symfony/http-client (v5/6). Use explicit versions in composer.json.php-http/discovery might auto-detect clients; pin to php-http/guzzle7-adapter for consistency.composer require andrewmy/rabbitmq-management-api php-http/guzzle7-adapter
.env:
RABBITMQ_MANAGEMENT_URL=http://user:pass@rabbitmq:15672/api/
app/Services/RabbitMqManager.php).public function publishToQueue(string $queue, string $message): bool {
$response = $this->client->exchanges()->publish(
'/',
$queue,
['payload' => $message]
);
return $response['routed'] ?? false;
}
public function handle() {
$this->rabbitMqManager->publishToQueue('notifications', $this->payload);
}
php-http stack may need manual version bumps.symfony/http-client supports pooling; configure in Laravel’s HTTP client.| Failure Scenario | Impact | Mitigation |
|---|---|---|
| RabbitMQ API downtime | Queue management fails | Fallback to raw HTTP calls or alerting. |
| Authentication token expiry | All API calls fail | Rotate tokens via Laravel’s env or cache. |
| Package bug (e.g., malformed JSON) | Silent failures or crashes | Validate responses with json_last_error(). |
| PHP HTTP client timeout | Long-running operations hang | Set short timeouts (e.g., 5s) and retry logic. |
| RabbitMQ version mismatch | API endpoints break | Pin RabbitMQ version in Docker/K8s. |
How can I help you explore Laravel packages today?