LaravelPackages.net
Acme Inc.
Toggle sidebar
septech-laravel/kafka

Rdkafka connector for Laravel

102
2
v1.0.5
About septech-laravel/kafka

septech-laravel/kafka is a Laravel package for rdkafka connector for laravel. It currently has 2 GitHub stars and 102 downloads on Packagist (latest version v1.0.5). Install it with composer require septech-laravel/kafka. Discover more Laravel packages by septech-laravel or browse all Laravel packages to compare alternatives.

Last updated

Installation

composer require septech-laravel/kafka 

Usage

Environment variables

# The kafka brokers, seperate by command
KAFKA_BROKERS=10.0.0.2,127.0.0.1
KAFKA_SSL_CA_LOCATION=./ca.crt

# For SSL client
SECURITY_PROTOCOL=[ssl | plaintext]
KAFKA_SSL_CERTIFICATE_LOCATION=./user.crt
KAFKA_SSL_KEY_LOCATION=./user.key
KAFKA_SSL_KEY_PASSWORD=SOME_PASSWORD

Via injection

<?php

use Septech\Kafka\Kafka;

class MessageController
{
    public function send(Kafka $kafka)
    {
        $message = json_encode(['message' => 'Hi, from kafka with love <3']);
        $kafka->produce("some.topic", $message);
    }
}

Via Facade

<?php

use Septech\Kafka\Facades\Kafka;

$message = json_encode(['message' => 'Hi, from kafka with love <3']);
Kafka::produce("some.topic", $message);

Look like package is missing something?

Well, nothing this absolutely perfect at first time. I just create this package for my purpose. If you want more features for this package. It needs you. Feel free send me a PR.

Comments