hhxsv5 / laravel-kafka-logger by hhxsv5

The Kafka logger for Laravel.
10,424
10
2
Package Data
Maintainer Username: hhxsv5
Maintainer Contact: hhxsv5@sina.com (Xie Biao)
Package Create Date: 2020-07-10
Package Last Update: 2020-07-13
Language: PHP
License: MIT
Last Refreshed: 2024-12-24 15:08:26
Package Statistics
Total Downloads: 10,424
Monthly Downloads: 123
Daily Downloads: 8
Total Stars: 10
Total Watchers: 2
Total Forks: 0
Total Open Issues: 0

laravel-kafka-logger

The Kafka logger for Laravel.

Latest Version PHP Version Total Downloads License

Requirements

| Dependency | Requirement | | -------- | -------- | | php-rdkafka | >=4.0.0 |

Install

1.Install rdkafka.

git clone --depth 1 https://github.com/edenhill/librdkafka.git /tmp/librdkafka && cd /tmp/librdkafka && ./configure && make -j$(nproc) && make install && rm -rf /tmp/librdkafka
pecl install rdkafka

2.Install laravel-kafka-logger.

# Laravel 5.x
composer require "hhxsv5/laravel-kafka-logger:~1.0.0"
# Laravel 6.x & 7.x
composer require "hhxsv5/laravel-kafka-logger:~2.0.0"

Get Started

1.Modify config/logging.php.

return [
    'channels' => [
        // ...
        'kafka' => Hhxsv5\LKL\KafkaLogger::getDefinition(['topic' => env('LOG_KAFKA_TOPIC', 'laravel-logs')]),
    ],
];

2.Modify .env.

LOG_CHANNEL=kafka
LOG_KAFKA_BROKER_LIST=kafka:9092
LOG_KAFKA_TOPIC=laravel-logs

License

MIT