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

ActiveLibrary

purplefan/php-rdkafka-bundle
============================

Integrates php-rdkafka with Symfony2|3

1.0.1(9y ago)07MITPHPPHP &gt;=5.6

Since Jul 25Pushed 9y ago1 watchersCompare

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

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

KafkaBundle
===========

[](#kafkabundle)

About
-----

[](#about)

This [Symfony](https://symfony.com) bundle provides connectivity to the [Kafka](http://kafka.apache.org) publish-subscribe messaging system based on [rdkafka](https://github.com/arnaud-lb/php-rdkafka) binding to [librdkafka](https://github.com/edenhill/librdkafka)

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

[](#installation)

Add the dependency in your composer.json

```
{
    "require": {
        "mshauneu/php-rdkafka-bundle"
    }
}
```

Enable the bundle in your application kernel

```
// app/AppKernel.php
public function registerBundles() {
    $bundles = array(
        // ...
        new Mshauneu\RdKafkaBundle\MshauneuRdKafkaBundle(),
    );
}
```

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

[](#configuration)

Simple configuration could look like:

```
mshauneu_rd_kafka:
  producers:
    test_producer:
      brokers: 127.0.0.1:9092
      topic: test_topic
  consumers:
    test_consumer:
      brokers: 127.0.0.1:9092
      topic: test_topic
      properties:
        group_id: "test_group_id"
      topic_properties:
        offset_store_method: broker
        auto_offset_reset: smallest
        auto_commit_interval_ms: 100
```

Configuration properties are documented:

- for producer or consumer in [CommunicatorConfiguration.php](https://github.com/mshauneu/php-rd-kafka-bundle/blob/master/src/Mshauneu/RdKafkaBundle/DependencyInjection/CommunicatorConfiguration.php)
- for topic to produce in [TopicProducerConfiguration.php](https://github.com/mshauneu/php-rd-kafka-bundle/blob/master/src/Mshauneu/RdKafkaBundle/DependencyInjection/TopicProducerConfiguration.php)
- for topic to consume in [TopicConsumerConfiguration.php](https://github.com/mshauneu/php-rd-kafka-bundle/blob/master/src/Mshauneu/RdKafkaBundle/DependencyInjection/TopicConsumerConfiguration.php)

Usage
-----

[](#usage)

### Publishing messages to a Kafka topic

[](#publishing-messages-to-a-kafka-topic)

From a Symfony controller:

```
$payload = 'test_message';
$topicProducer = $container->get('mshauneu_rd_kafka')->getProducer("test_producer");
$topicProducer->produceStart();
$topicProducer->produce("message");
$topicProducer->produceStop();
```

By CLI:

```
./app/console kafka:producer --producer test_producer test_message
```

### Consume messages out of a Kafka topic:

[](#consume-messages-out-of-a-kafka-topic)

Implement [ConsumerInterface](https://github.com/mshauneu/php-rd-kafka-bundle/blob/master/src/Mshauneu/RdKafkaBundle/Topic/ConsumerInterface.php)

```
class MessageHandler implements ConsumerInterface {
	public function consume($topic, $partition, $offset, $key, $payload) {
		echo "Received payload: " . $payload . PHP_EOL;
	}
}
```

Register it:

```
test_message_handler:
    class: MessageHandler
```

From a Symfony controller:

```
$topicConsumer = $container->get('mshauneu_rd_kafka')->getConsumer("test_producer");
$topicConsumer->consumeStart(TopicCommunicator::OFFSET_STORED);
$topicConsumer->consume($consumerImpl);
$topicConsumer->consumeStop();
```

By CLI:

```
./app/console kafka:consumer --consumer test_consumer --handler test_message_handler
```

License
-------

[](#license)

This project is under the MIT License. See the [LICENSE](https://github.com/mshauneu/php-rd-kafka-bundle/blob/master/LICENSE) file for the full license text.

###  Health Score

25

—

LowBetter than 40% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 55.6% 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

Every ~70 days

Total

2

Last Release

3456d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8c1e015d6dae497bcdea27153fbe8d006d8b2aaf03c787584954417931de1ed4?d=identicon)[purplefan](/maintainers/purplefan)

---

Top Contributors

[![mshauneu](https://avatars.githubusercontent.com/u/5759779?v=4)](https://github.com/mshauneu "mshauneu (5 commits)")[![purplefan](https://avatars.githubusercontent.com/u/6502528?v=4)](https://github.com/purplefan "purplefan (3 commits)")[![mweibel](https://avatars.githubusercontent.com/u/307427?v=4)](https://github.com/mweibel "mweibel (1 commits)")

---

Tags

phpsymfonykafka

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/purplefan-php-rdkafka-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/purplefan-php-rdkafka-bundle/health.svg)](https://phpackages.com/packages/purplefan-php-rdkafka-bundle)
```

###  Alternatives

[mshauneu/php-rdkafka-bundle

Integrates php-rdkafka with Symfony2|3

1426.8k](/packages/mshauneu-php-rdkafka-bundle)[harmbandstra/swagger-ui-bundle

Exposes swagger UI inside your Symfony project through a route (eg. /docs)

42860.5k](/packages/harmbandstra-swagger-ui-bundle)[inspector-apm/inspector-symfony

Code Execution Monitoring for Symfony applications.

2828.1k1](/packages/inspector-apm-inspector-symfony)[visithor/visithor-bundle

Visithor Bundle for Symfony

1620.2k3](/packages/visithor-visithor-bundle)

PHPackages © 2026

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