PHP code example of xiaochengfu / yii2-kafka
1. Go to this page and download the library: Download xiaochengfu/yii2-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/ */
xiaochengfu / yii2-kafka example snippets
return [
'kafka'=>[
'sasl_plain_username' => '填写阿里云的Access Key ID',
'sasl_plain_password' => '填写阿里云的Access Key Secret后10位',
'bootstrap_servers' => "kafka-ons-internet.aliyun.com:8080",
'topic_name' => '您的topic名称',
'consumer_id' => '您的CID',
'processName'=>'kafka-master',//j进程名称
'callback'=>'common\\components\\kafka\\Consumer'//消费业务回调处理名字空间
]
];