twidpay / utils
twidpay 的实用工具
2.0.8
2024-09-12 12:23 UTC
Requires
- ramsey/uuid: ^4.2.2
- twidpay/twid-logger: ^2.0
Requires (Dev)
- php-mock/php-mock: ^2.2
- phpunit/phpunit: ^7.0|^8.0|^9.0
This package is auto-updated.
Last update: 2024-09-12 12:24:07 UTC
README
这个 PHP 库提供了一个使用 RdKafka PHP 扩展生成 Kafka 主题消息的便捷方式。
安装
-
需求:
- RdKafka PHP 扩展 (安装说明)
-
通过 Composer 安装:
您可以通过 Composer 安装这个库。在您的终端中运行以下命令
composer require twidpay/utils
-
用法:
- KafkaProducer 所有可能的配置都可以在这里找到 这里
use Utils\queue\KafkaProducer; $config = [ 'metadata.broker.list' => 'localhost:9092', 'compression.codec' => 'snappy', 'security.protocol' => 'ssl', //other kafka configuration ]; $this->kafkaProducer = new KafkaProducer($config); //key is optional $this->kafkaProducer->produce($topic, $message, $key);