PHPackages                             staryphp/kafka - 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. staryphp/kafka

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

staryphp/kafka
==============

Kafka client for php

v1.0(4y ago)05proprietaryPHPPHP &gt;=5.5

Since May 26Pushed 4y ago1 watchersCompare

[ Source](https://github.com/chenduansheng/stary-kafka)[ Packagist](https://packagist.org/packages/staryphp/kafka)[ RSS](/packages/staryphp-kafka/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependencies (7)Versions (2)Used By (0)

Kafka-php
=========

[](#kafka-php)

[中文文档](README_CH.md)

![QQ Group](https://camo.githubusercontent.com/bbded5264c89cf8213f9cc393646cf532ec81529fc70f323e2b8a4e442c9a253/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f515125323047726f75702d3533313532323039312d627269676874677265656e2e737667)[![Build Status](https://camo.githubusercontent.com/03cc1b505ff65fc3d81d78e30080e163155e967fb9e9604d6948f0d2012535ee/68747470733a2f2f7472617669732d63692e6f72672f776569626f61642f6b61666b612d7068702e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/weiboad/kafka-php)![Packagist](https://camo.githubusercontent.com/58fb278bc92c75ce5fb540a2ea017ac01d018cbd445e3819625451316128e512/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f6e6d7265642f6b61666b612d7068702e7376673f7374796c653d706c6173746963)![Packagist](https://camo.githubusercontent.com/c3db38aca7268618b824e9a59d50a7c725132e0a9e0a87e680bee990693c2b8c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64642f6e6d7265642f6b61666b612d7068702e7376673f7374796c653d706c6173746963)![Packagist](https://camo.githubusercontent.com/64e6368f9cead67b89586b883ab76f13bb15f34b41519195fac17645952eaca0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6e6d7265642f6b61666b612d7068702e7376673f7374796c653d706c6173746963)[![GitHub issues](https://camo.githubusercontent.com/ab8bdc6e071cd4e28d68f7ea89a11fcba37d13d54db0918b19991abe393dd6d5/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f776569626f61642f6b61666b612d7068702e7376673f7374796c653d706c6173746963)](https://github.com/weiboad/kafka-php/issues)[![GitHub forks](https://camo.githubusercontent.com/4d250ad3707f42ba4991dc48da692e2b67cdf2029ec713590be5d5467fe7121c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f666f726b732f776569626f61642f6b61666b612d7068702e7376673f7374796c653d706c6173746963)](https://github.com/weiboad/kafka-php/network)[![GitHub stars](https://camo.githubusercontent.com/aacf2ef6f0e560ab64c13f351d7ad809b8e9715c0a73158dde96b37071b66ffd/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f776569626f61642f6b61666b612d7068702e7376673f7374796c653d706c6173746963)](https://github.com/weiboad/kafka-php/stargazers)[![GitHub license](https://camo.githubusercontent.com/f123f9fed5c4a86bb78ea213fcef0db957ac50229e2588cb2fc702a3d9764971/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d417061636865253230322d626c75652e7376673f7374796c653d706c6173746963)](https://raw.githubusercontent.com/weiboad/kafka-php/master/LICENSE)

Kafka-php is a pure PHP kafka client that currently supports greater than 0.8.x version of Kafka, this project v0.2.x and v0.1.x are incompatible if using the original v0.1.x You can refer to the document [Kafka PHP v0.1.x Document](https://github.com/weiboad/kafka-php/blob/v0.1.6/README.md), but it is recommended to switch to v0.2.x . v0.2.x use PHP asynchronous implementation and kafka broker interaction, more stable than v0.1.x efficient, because the use of PHP language so do not compile any expansion can be used to reduce the access and maintenance costs

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

[](#requirements)

- Minimum PHP version: 5.5
- Kafka version greater than 0.8
- The consumer module needs kafka broker version greater than 0.9.0

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).

Composer Install
----------------

[](#composer-install)

Simply add a dependency on nmred/kafka-php to your project's composer.json file if you use Composer to manage the dependencies of your project. Here is a minimal example of a composer.json file :

```
{
	"require": {
		"nmred/kafka-php": "0.2.*"
	}
}

```

Configuration
-------------

[](#configuration)

Configuration properties are documented in [Configuration](docs/Configure.md)

Producer
--------

[](#producer)

### Asynchronous mode

[](#asynchronous-mode)

```
