PHPackages                             rdkafka/rdkafka - 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. rdkafka/rdkafka

ActivePhp-ext[HTTP &amp; Networking](/categories/http)

rdkafka/rdkafka
===============

A PHP extension for Kafka

6.0.5(1y ago)2.2k13.6k↑109.4%272[27 issues](https://github.com/arnaud-lb/php-rdkafka/issues)[3 PRs](https://github.com/arnaud-lb/php-rdkafka/pulls)1MITCPHP &gt;= 7.0.0CI passing

Since Nov 4Pushed 11mo ago80 watchersCompare

[ Source](https://github.com/arnaud-lb/php-rdkafka)[ Packagist](https://packagist.org/packages/rdkafka/rdkafka)[ GitHub Sponsors](https://github.com/arnaud-lb)[ RSS](/packages/rdkafka-rdkafka/feed)WikiDiscussions 7.x Synced 1mo ago

READMEChangelog (10)DependenciesVersions (4)Used By (1)

PHP Kafka client - php-rdkafka
==============================

[](#php-kafka-client---php-rdkafka)

[![Join the chat at https://gitter.im/arnaud-lb/php-rdkafka](https://camo.githubusercontent.com/d6dc1843ef29cd19fd295c461d5a87a1f7d124f110258bb8858e7276286fe47a/68747470733a2f2f6261646765732e6769747465722e696d2f61726e6175642d6c622f7068702d72646b61666b612e737667)](https://gitter.im/arnaud-lb/php-rdkafka?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

[![Supported librdkafka versions: >= 0.11](https://camo.githubusercontent.com/aff5594ddc668d944052954b4abe022328e83f6edfa608da2c5bb36ba0cb1027/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c696272646b61666b612d253345253344253230302e31312d626c75652e737667)](https://github.com/edenhill/librdkafka/releases) [![Supported Kafka versions: >= 0.8](https://camo.githubusercontent.com/9d605f7f99aa9cf133a77a819bd4b752bea963b78ef022ced32f762712bbcf7d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6b61666b612d253345253344253230302e382d626c75652e737667)](https://github.com/edenhill/librdkafka/blob/master/INTRODUCTION.md#broker-version-compatibility) [![Supported PHP versions: 7.x .. 8.x](https://camo.githubusercontent.com/87ae00a00148a8db5c6c8cadefa3584bbb6074dc7636047144ca359c00111016/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d372e782532302e2e253230382e782d626c75652e737667)](https://camo.githubusercontent.com/87ae00a00148a8db5c6c8cadefa3584bbb6074dc7636047144ca359c00111016/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d372e782532302e2e253230382e782d626c75652e737667)

PHP-rdkafka is a **stable**, **production-ready**, and **fast** Kafka client for PHP based on [librdkafka](https://github.com/edenhill/librdkafka).

Current version supports PHP &gt;= 8.1.0, librdkafka &gt;= 1.5.3, Kafka &gt;= 0.8. Version [6.x](https://github.com/arnaud-lb/php-rdkafka/tree/6.x) supports PHP 7.x..8.x, librdkafka 0.11..2.x. Older versions support PHP 5.

The goal of the extension is to be a low-level un-opinionated librdkafka binding focused on production and long term support.

The high level and low level *consumers*, *producer*, and *metadata* APIs are supported.

Documentation is available [here](https://arnaud-lb.github.io/php-rdkafka/phpdoc/book.rdkafka.html).

Table of Contents
-----------------

[](#table-of-contents)

1. [Installation](#installation)
2. [Examples](#examples)
3. [Usage](#usage)
    - [Producing](#producing)
    - [High-level consuming](#high-level-consuming)
    - [Low-level consuming (legacy)](#low-level-consuming-legacy)
    - [Low-level consuming from multiple topics / partitions (legacy)](#low-level-consuming-from-multiple-topics--partitions-legacy)
    - [Using stored offsets](#using-stored-offsets)
    - [Interesting configuration parameters](#interesting-configuration-parameters)
        - [queued.max.messages.kbytes](#queuedmaxmessageskbytes)
        - [topic.metadata.refresh.sparse and topic.metadata.refresh.interval.ms](#topicmetadatarefreshsparse-and-topicmetadatarefreshintervalms)
        - [internal.termination.signal](#internalterminationsignal)
4. [Documentation](#documentation)
5. [Credits](#credits)
6. [License](#license)

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

[](#installation)

Examples
--------

[](#examples)

Usage
-----

[](#usage)

Configuration parameters used below can be found in [Librdkafka Configuration reference](https://github.com/edenhill/librdkafka/blob/master/CONFIGURATION.md)

### Producing

[](#producing)

#### Creating a producer

[](#creating-a-producer)

For producing, we first need to create a producer, and to add brokers (Kafka servers) to it:

```
