PHP code example of laravel-tool / kafka-queue

1. Go to this page and download the library: Download laravel-tool/kafka-queue 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/ */

    

laravel-tool / kafka-queue example snippets


'kafka' => [
    'driver' => 'kafka',
    'broker_list' => env('KAFKA_BROKER_LIST', 'kafka:9092'),
    'auth' => [
        'enable' => env('KAFKA_AUTH_ENABLE', false),
        'mechanism' => env('KAFKA_AUTH_MECHANISM', 'PLAIN'),
        'username' => env('KAFKA_AUTH_USERNAME'),
        'password' => env('KAFKA_AUTH_PASSWORD'),
        'ssl_ca_location' => env('KAFKA_AUTH_SSL_CA_LOCATION'),
    ],
    'queue' => env('KAFKA_QUEUE', 'default'),
    'heartbeat_ms' => env('KAFKA_HEARTBEAT', 5000),
    'group_name' => env('KAFKA_QUEUE_GROUP', 'default'),
    'producer_timeout_ms' => 1000,
    'consumer_timeout_ms' => 3000,
    'queue_disable_length' => false, // Disable this if trouble with performance
    'horizon' => true, // Support for Laravel Horizon
    'after_commit' => false,
],