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

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

memran/marwa-kafka
==================

A lightweight, secure Kafka producer/consumer wrapper with Envelop messaging support

v1.0.0(3mo ago)00MITPHPPHP ^8.2CI passing

Since Mar 31Pushed 3mo agoCompare

[ Source](https://github.com/memran/marwa-kafka)[ Packagist](https://packagist.org/packages/memran/marwa-kafka)[ RSS](/packages/memran-marwa-kafka/feed)WikiDiscussions main Synced today

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

Marwa Kafka
===========

[](#marwa-kafka)

[![CI Status](https://github.com/memran/marwa-kafka/actions/workflows/ci.yml/badge.svg)](https://github.com/memran/marwa-kafka/actions/workflows/ci.yml)[![PHP](https://camo.githubusercontent.com/c2588b5670f2c910b8cc849ace22a22efda8956b7c2f797d11d2096bbfc7b1f5/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e322532422d3737374242342e737667)](https://www.php.net/releases/)[![PHPUnit](https://camo.githubusercontent.com/f120a5bf15ab6d558fbc674b53ad408e517f109b2e53337dcde3c4bbe9cf6259/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f504850556e69742d31302e782d3041354139432e737667)](https://phpunit.de/)[![PHPStan](https://camo.githubusercontent.com/83bee26ca8e5e492b642644349d439a0e9d9844654067dbdc4708987289cb547/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d322e782d3331433635322e737667)](https://phpstan.org/)[![Code Style](https://camo.githubusercontent.com/0556484b0171c30a4d0b3e3bd40142811739a5c1f5f0ccbc0e609f06dd6a19a3/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f436f64652532305374796c652d5048502d2d43532d2d46697865722d4637423933452e737667)](https://cs.symfony.com/)[![Kafka Integration](https://camo.githubusercontent.com/233317710864610e8863e1d8c9c379fdd5d7e5453734e798d7e7f8f244c1acc2/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4b61666b61253230496e746567726174696f6e2d446f636b657225323025324225323043492d3233314632302e737667)](/docker-compose.yml)[![Latest Version](https://camo.githubusercontent.com/34430e32745dc99b7c5ecac4b57cf9f164b19496df275fd14ac137ba47048ada/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d656d72616e2f6d617277612d6b61666b612e737667)](https://packagist.org/packages/memran/marwa-kafka)[![Downloads](https://camo.githubusercontent.com/a3301ab5430419c62c2319f1b760e69920b63d5ba2da11c1cd5ff120e9189d40/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d656d72616e2f6d617277612d6b61666b612e737667)](https://packagist.org/packages/memran/marwa-kafka)[![License](https://camo.githubusercontent.com/1cde10ed2b251b925b4e3caa682ecf2fd0eb7a8baacd0fb7b4e3db186afb19c1/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6d656d72616e2f6d617277612d6b61666b61)](LICENSE)

`memran/marwa-kafka` is a production-focused Kafka producer/consumer library for PHP 8.2+. It wraps `php-rdkafka` with signed envelope handling from `memran/marwa-envelop` v2, safer configuration validation, PSR-3 logging hooks, and a lightweight developer workflow.

Features
--------

[](#features)

- Lazy Kafka producer and consumer setup with PSR-4 autoloading
- Envelope signing, signature validation, and TTL-aware message filtering
- Early validation for brokers, topics, group IDs, secrets, and timeout values
- Optional PSR-3 structured logging for invalid or failed consumer message handling
- PHPUnit, PHPStan 2.x, PHP-CS-Fixer, and GitHub Actions quality gates
- Real Kafka integration tests for Docker and CI environments with `ext-rdkafka`

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

[](#requirements)

- PHP 8.2 or newer
- `ext-rdkafka`
- A reachable Kafka broker
- `memran/marwa-envelop` v2

Install the package:

```
composer require memran/marwa-kafka
```

Install the extension if needed:

```
pecl install rdkafka
```

Quick Start
-----------

[](#quick-start)

### Produce a signed message

[](#produce-a-signed-message)

```
