PHPackages                             simpod/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. [Utility &amp; Helpers](/categories/utility)
4. /
5. simpod/kafka

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

simpod/kafka
============

PHP Kafka boilerplate wrapper around RdKafka

0.4.1(3mo ago)6137.3k↓23.5%[1 issues](https://github.com/simPod/PhpKafka/issues)1MITPHPPHP ^8.4CI passing

Since Jul 3Pushed 2w agoCompare

[ Source](https://github.com/simPod/PhpKafka)[ Packagist](https://packagist.org/packages/simpod/kafka)[ GitHub Sponsors](https://github.com/simPod)[ RSS](/packages/simpod-kafka/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (10)Dependencies (18)Versions (20)Used By (1)

PHP Kafka boilerplate wrapper around RdKafka
============================================

[](#php-kafka-boilerplate-wrapper-around-rdkafka)

[![GitHub Actions](https://github.com/simPod/PhpKafka/workflows/CI/badge.svg)](https://github.com/simPod/PhpKafka/actions?query=workflow%3A%22CI%22+branch%3Amaster)[![Code Coverage](https://camo.githubusercontent.com/1133b333cbdb34d876e67ff7345b47ca47766a0ea74e6f3ebcc5a1af5a7de6a5/68747470733a2f2f636f6465636f762e696f2f67682f73696d506f642f5068704b61666b612f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/simPod/PhpKafka/branch/master)[![Downloads](https://camo.githubusercontent.com/547c30a97022d9ec3c98b0934d64fec417cf6043b2738c1503206a8c05b56fc9/68747470733a2f2f706f7365722e707567782e6f72672f73696d706f642f6b61666b612f642f746f74616c2e737667)](https://packagist.org/packages/simpod/kafka)[![Packagist](https://camo.githubusercontent.com/06e8f63e37091aa7b6ea391f8fd77b8740065f7bfef4e5c7c425f97bff6be010/68747470733a2f2f706f7365722e707567782e6f72672f73696d706f642f6b61666b612f762f737461626c652e737667)](https://packagist.org/packages/simpod/kafka)[![Infection MSI](https://camo.githubusercontent.com/e1e83e48a79f9e51212c44b0ccbc792208ad8811857e6025f35c33d432bf2b8f/68747470733a2f2f696d672e736869656c64732e696f2f656e64706f696e743f7374796c653d666c61742675726c3d687474707325334125324625324662616467652d6170692e737472796b65722d6d757461746f722e696f2532466769746875622e636f6d25324673696d506f642532465068704b61666b612532466d6173746572)](https://infection.github.io)

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

[](#installation)

Add as [Composer](https://getcomposer.org/) dependency:

```
composer require simpod/kafka
```

Config Constants
----------------

[](#config-constants)

Some config constants are provided like `ConsumerConfig`, `ProducerConfig` or `CommonClientConfigs`.

However, they are copied from Java API and not all are applicable to librdkafka. Consult with librdkafka documentation before use.

Clients
-------

[](#clients)

### Consumer

[](#consumer)

`KafkaConsumer` boilerplate is available with `startBatch()` method ([to suplement this example in librdkafka](https://github.com/edenhill/librdkafka/blob/master/examples/rdkafka_consume_batch.cpp#L97)) and with `start()`. They also handle termination signals for you.

#### Classic Consumer

[](#classic-consumer)

```
