PHP code example of septech-laravel / kafka
1. Go to this page and download the library: Download septech-laravel/kafka library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
septech-laravel / kafka example snippets
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);
}
}
use Septech\Kafka\Facades\Kafka;
$message = json_encode(['message' => 'Hi, from kafka with love <3']);
Kafka::produce("some.topic", $message);