New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

s008nyx/kafka-bus

Kafka bus integration to Laravel/Lumen
87 1

Larablocks Analysis

s008nyx/kafka-bus works with Laravel 7 and 8 (latest release 0.2.1, Oct 15, 2021), all past end of life (the last on Jan 24, 2023): no more fixes, even for security.

Recommendation checks

Not advised

Not advised: no release or commit in over 2 years.

  • No release or commit in over 2 years
  • Supports only Laravel 7 and 8, past end of life since Jan 24, 2023
  • No release in the last 12 months (last: Oct 15, 2021)
  • 0 downloads a month (needs 10,000)
  • 1 GitHub star (needs 100)

State

Likely abandoned
  • No release or commit in over 2 years.
  • Last stable release: Oct 15, 2021.
  • No releases in the last 12 months.
  • First released: Oct 13, 2021.
  • 0 open issues on GitHub.

Data from Packagist and GitHub, checked by Larablocks on Dec 1, 2026.

Install
composer require s008nyx/kafka-bus
Latest Version:0.2.1
PHP:^7.2 || ^8.0
Laravel:7 · 8
License:MIT
Last Updated:Oct 15, 2021
Links: GitHub  ·  Packagist
Maintainer: s008nyx

kafka-bus

Installation

Install package

composer require s008nyx/kafka-bus

For Lumen

Open your bootstrap/app.php file and:

  • add this line before Register Container Bindings section:
     $app->configure('kafka-bus');
  • add this line in Register Service Providers section:
    $app->register(\KafkaBus\KafkaBusServiceProvider::class);

Add environment variables

KAFKA_BROKERS="kafka-node01:9093,kafka-node02:9093"
KAFKA_AUTOCOMMIT=true
KAFKA_GROUP_ID="myGroup"
KAFKA_SECURITY_PROTOCOL=SASL_SSL
KAFKA_SASL_MECHANISMS=SCRAM-SHA-512
KAFKA_SASL_PASSWORD=password
KAFKA_SASL_USERNAME=username
KAFKA_SSL_CA_LOCATION=/path/to/ca.crt
KAFKA_SSL_CERTIFICATE_LOCATION=/path/to/chain.crt

Usage

Create Handler

MyHandler.php

<?php

use KafkaBus\Error;
use KafkaBus\KafkaHandler;
use RdKafka\Message;

class MyHandler implements KafkaHandler
{
    /**
     * Topics list
     * @return array
     */
    public function getTopics(): array
    {
        return ['myTopic'];
    }

    /**
     * Processing success message
     * @param Message $message
     * @return bool
     */
    public function process(Message $message): bool
    {
        // Do something
    }

    /**
     * Processing fail message
     * @param Error $error
     * @return bool
     */
    public function error(Error $error): bool
    {
        // Do something
    }
}

Create artisan command

KafkaCommand.php

<?php

namespace App\Console\Commands;

use KafkaBus\Consumer;
use Illuminate\Console\Command;

class KafkaConsumer extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'kafka:consume';

    /**
     * @param Consumer $consumer
     */
    public function handle(Consumer $consumer)
    {
        try {
            $consumer->consume(new MyHandler());
        } catch (\Exception $e) {
            $this->error($e->getMessage());
        }
    }
}

Start command

php artisan kafka:consume

Related Packages

leroy-merlin-br/metamorphosis

Kafka package for laravel applications

32,138 42
mr-luke/bus

Multi-purpose bus for Laravel

1,389 0
arquivei/php-kafka-consumer

A consumer of Kafka in PHP

86,634 5
buqiu/kafka

Kafka distributed publish subscribe message system extension package.

4,170 0
gurento/kafka-consumer

Laravel Kafka consumer module with topic mapping, retry tracking, and operationa...

1,248 1

Version History

Version Released PHP Laravel License
0.2.1 ^7.2 || ^8.0 ^8.0 || ^7.0 MIT
0.2.0 ^7.2 ^8.0 || ^7.0 MIT
0.1.0 ^7.2 ^8.0 || ^7.0 MIT
0.0.2 ^7.2 ^8.0 || ^7.0 MIT
0.0.1 ^7.2 ^8.0 || ^7.0 MIT