jonston / amqp-laravel
Simple wrapper for amqp library to use in Laravel
v0.5.1
2025-08-07 11:36 UTC
Requires
- php: ^8.0
- php-amqplib/php-amqplib: ^3.7
Requires (Dev)
- laravel/framework: ^9.0|^10.0|^11.0|^12.0
- mockery/mockery: ^1.0
- orchestra/testbench: ^7.0|^8.0|^9.0|^10.0
- phpunit/phpunit: ^10.0|^11.0
README
Simple wrapper for AMQP library to use in Laravel applications.
Installation
Install the package via Composer:
composer require jonston/amqp-laravel
Configuration
Publish the configuration file:
php artisan vendor:publish --tag=amqp-config
This will create a config/amqp.php
file where you can set your RabbitMQ connection parameters.
Add these variables to your .env
file:
AMQP_HOST=localhost AMQP_PORT=5672 AMQP_USER=guest AMQP_PASSWORD=guest AMQP_VHOST=/
Usage
Inject the AMQPService into your classes:
<?php namespace App\Http\Controllers; use Jonston\AmqpLaravel\AMQPService; class OrderController extends Controller { public function __construct( private AMQPService $amqpService ) {} public function processOrder() { // Use the AMQP service $this->amqpService->publish('order.created', $orderData); } }
Or resolve it from the container:
$amqpService = app(AMQPService::class);
Requirements
- PHP >= 8.1
- Laravel >= 9.0
License
MIT License