承接 quipo/kafka-php 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

quipo/kafka-php

Composer 安装命令:

composer require quipo/kafka-php

包简介

PHP client library for Apache Kafka 0.7

README 文档

README

kafka-php allows you to produce messages to the Apache Kafka distributed publish/subscribe messaging service.

Requirements

  • Minimum PHP version: 5.3.3.
  • Apache Kafka 0.6.x or 0.7.x.
  • You need to have access to your Kafka instance and be able to connect through TCP. You can obtain a copy and instructions on how to setup kafka at https://github.com/kafka-dev/kafka
  • The PHP Zookeeper extension is required if you want to use the Zookeeper-based consumer.

Installation

Add the lib directory to the PHP include_path and use an autoloader like the one in the examples directory (the code follows the PEAR/Zend one-class-per-file convention).

Usage

The examples directory contains an example of a Producer and a simple Consumer, and an example of the Zookeeper-based Consumer.

Example Producer:

$producer = new Kafka_Producer('localhost', 9092, Kafka_Encoder::COMPRESSION_NONE);
$messages = array('some', 'messages', 'here');
$topic = 'test';
$bytes = $producer->send($messages, $topic);

Example Consumer:

$topic         = 'test';
$partition     = 0;
$offset        = 0;
$maxSize       = 1000000;
$socketTimeout = 5;

while (true) {
    $consumer = new Kafka_SimpleConsumer('localhost', 9092, $socketTimeout, $maxSize);
    $fetchRequest = new Kafka_FetchRequest($topic, $partition, $offset, $maxSize);
    $messages = $consumer->fetch($fetchRequest);
    foreach ($messages as $msg) {
        echo "\nMessage: " . $msg->payload();
    }
    //advance the offset after consuming each MessageSet
    $offset += $messages->validBytes();
    unset($fetchRequest);
}

TODO

  • support for Snappy compression

Contact for questions

Lorenzo Alberton

l.alberton at(@) quipo.it

http://twitter.com/lorenzoalberton

http://alberton.info/

quipo/kafka-php 适用场景与选型建议

quipo/kafka-php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 105.09k 次下载、GitHub Stars 达 206, 最近一次更新时间为 2018 年 09 月 13 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 quipo/kafka-php 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 quipo/kafka-php 我们能提供哪些服务?
定制开发 / 二次开发

基于 quipo/kafka-php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 105.09k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 207
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 206
  • Watchers: 26
  • Forks: 62
  • 开发语言: PHP

其他信息

  • 授权协议: Apache
  • 更新时间: 2018-09-13