Skip to content

idealo/php-rdkafka-ffi

Folders and files

NameName
Last commit message
Last commit date
Jan 25, 2025
Oct 24, 2021
Jan 21, 2023
Jan 21, 2025
Jan 25, 2025
Jan 25, 2025
Jan 25, 2025
Nov 28, 2020
Dec 23, 2023
Feb 6, 2022
Jan 21, 2025
Feb 6, 2022
May 28, 2020
Jan 25, 2025
Oct 21, 2024
Oct 21, 2024
Jan 21, 2023
Feb 6, 2022
Oct 23, 2024

Repository files navigation

PHP Kafka Client

Build Extension Compatibility Build macOS Build Windows

Test Coverage Maintainability Packagist

This is a Kafka client library for PHP ^7.4 and ^8.0 with a slim librdkafka binding via FFI.

It supports the same interfaces as the PHP RdKafka extension ^5.0 and ^6.0.

Supported Features

  • Consumer (low and high level)
  • Producer (with support for transactional producing)
  • Admin Client
  • Mock Cluster to simplify integration tests (even with error situations)
  • Support for error handling and logging via callbacks

Runtime Requirements

  • PHP ^7.4 or ^8.0 with extensions FFI enabled
  • librdkafka ^1.0.0 or ^2.0.0
  • Conflicts: RdKafka extension
  • Suggested:
    • zend opcache extension for preloading
    • pcntl extension for faster shutdown in request/response context

Note: From PHP 8.3 onwards, you must disable the stack overflow check by setting zend.max_allowed_stack_size=-1 in your php.ini. This is necessary because FFI callbacks are executed off the main thread, and the overflow checks do not handle this scenario properly.

Note: Support for macOS and Windows is experimental.

Installation

composer require idealo/php-rdkafka-ffi

Note: Expect breaking changes along all 0.* pre-releases. This changes may depend on upcoming major releases of the RdKafka extension or improved interfaces for the experimental features like transactional producer, mock cluster and admin client.

Documentation

https://idealo.github.io/php-rdkafka-ffi/

Changelog

See Changelog for details.

Contributing

We welcome all kinds of contributions. See the Contribution guide for more details.

License

See License for details.