PHPackages                             mr-pingo/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. mr-pingo/kafka-php

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

mr-pingo/kafka-php
==================

Kafka client for php

v0.2.0.9(4y ago)0401BSD-3-ClausePHPPHP ^7.1

Since Sep 29Pushed 4y agoCompare

[ Source](https://github.com/mr-pingo/kafka-php)[ Packagist](https://packagist.org/packages/mr-pingo/kafka-php)[ RSS](/packages/mr-pingo-kafka-php/feed)WikiDiscussions master Synced today

READMEChangelog (1)Dependencies (15)Versions (18)Used By (0)

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

[](#kafka-php)

[中文文档](README_CH.md)

![QQ Group](https://camo.githubusercontent.com/53ef76296e6ec3f2c62726bf804d5c1a889aec51f0f6f7feca6cbcad08cdd85c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f515125323047726f75702d3635373531373935352d627269676874677265656e2e737667)[![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: 7.1
- 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 `nmred/kafka-php` to your project if you use Composer to manage the dependencies of your project.

`$ composer require nmred/kafka-php`

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)

```
