-
Install librdkafka c library
$ cd /tmp $ mkdir librdkafka $ cd librdkafka $ git clone https://github.com/edenhill/librdkafka.git . $ ./configure $ make $ make install
-
Install the php-rdkafka PECL extension
$ pecl install rdkafka
-
Add the following to your php.ini file to enable the php-rdkafka extension
extension=rdkafka.so
-
Install this package via composer using:
composer require rapide/laravel-queue-kafka
-
Add LaravelQueueKafkaServiceProvider to
providers
array inconfig/app.php
:Rapide\LaravelQueueKafka\LaravelQueueKafkaServiceProvider::class,
-
Add these properties to
.env
with proper values:QUEUE_DRIVER=kafka
Once you completed the configuration you can use Laravel Queue API. If you used other queue drivers you do not need to change anything else. If you do not know how to use Queue API, please refer to the official Laravel documentation: http://laravel.com/docs/queues
Run the tests with:
vendor/bin/phpunit
This library is inspired by laravel-queue-rabbitmq by vyuldashev. And the Kafka implementations by Superbalist be sure to check those out.
You can contribute to this package by discovering bugs and opening issues. Please, add to which version of package you create pull request or issue.
Tested on: [5.4]