PHPackages                             quipo/kafka-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. quipo/kafka-php

ActiveLibrary[HTTP &amp; Networking](/categories/http)

quipo/kafka-php
===============

PHP client library for Apache Kafka 0.7

v1.0.0(10y ago)208105.1k↓100%62[2 issues](https://github.com/quipo/kafka-php/issues)ApachePHP

Since Oct 27Pushed 5y ago26 watchersCompare

[ Source](https://github.com/quipo/kafka-php)[ Packagist](https://packagist.org/packages/quipo/kafka-php)[ RSS](/packages/quipo-kafka-php/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

kafka-php
=========

[](#kafka-php)

kafka-php allows you to produce messages to the [Apache Kafka](http://kafka.apache.org/) distributed publish/subscribe messaging service.

Requirements
------------

[](#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
- The [PHP Zookeeper extension](https://github.com/andreiz/php-zookeeper) is required if you want to use the Zookeeper-based consumer.

Installation
------------

[](#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
-----

[](#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
----

[](#todo)

- support for Snappy compression

Contact for questions
---------------------

[](#contact-for-questions)

Lorenzo Alberton

l.alberton at(@) quipo.it

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity45

Moderate usage in the ecosystem

Community24

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 79.3% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

3848d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/34345d791fb6e3374264038dd5da6b0981b6bd90f946e91a3432692bc7faee00?d=identicon)[quipo](/maintainers/quipo)

---

Top Contributors

[![quipo](https://avatars.githubusercontent.com/u/321794?v=4)](https://github.com/quipo "quipo (23 commits)")[![shyamalprasad](https://avatars.githubusercontent.com/u/1062696?v=4)](https://github.com/shyamalprasad "shyamalprasad (2 commits)")[![adrienbrault](https://avatars.githubusercontent.com/u/611271?v=4)](https://github.com/adrienbrault "adrienbrault (1 commits)")[![mheap](https://avatars.githubusercontent.com/u/59130?v=4)](https://github.com/mheap "mheap (1 commits)")[![mpitid](https://avatars.githubusercontent.com/u/211314?v=4)](https://github.com/mpitid "mpitid (1 commits)")[![saji89](https://avatars.githubusercontent.com/u/236861?v=4)](https://github.com/saji89 "saji89 (1 commits)")

### Embed Badge

![Health badge](/badges/quipo-kafka-php/health.svg)

```
[![Health](https://phpackages.com/badges/quipo-kafka-php/health.svg)](https://phpackages.com/packages/quipo-kafka-php)
```

###  Alternatives

[friendsofsymfony/rest-bundle

This Bundle provides various tools to rapidly develop RESTful API's with Symfony

2.8k73.3M317](/packages/friendsofsymfony-rest-bundle)[php-http/discovery

Finds and installs PSR-7, PSR-17, PSR-18 and HTTPlug implementations

1.3k309.5M1.2k](/packages/php-http-discovery)[nyholm/psr7

A fast PHP7 implementation of PSR-7

1.3k235.4M2.4k](/packages/nyholm-psr7)[pusher/pusher-php-server

Library for interacting with the Pusher REST API

1.5k94.8M292](/packages/pusher-pusher-php-server)[spatie/crawler

Crawl all internal links found on a website

2.8k16.3M52](/packages/spatie-crawler)[react/http

Event-driven, streaming HTTP client and server implementation for ReactPHP

78126.4M414](/packages/react-http)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
