Backend Development 2 min read

PHP Kafka Client Library (longlang/phpkafka) Overview

The PHP Kafka client library supports PHP‑FPM and Swoole environments, implements all 50 Kafka APIs with compression, SSL, and SASL features, requires PHP ≥ 7.1 and Kafka ≥ 1.0.0, and can be installed via Composer.

Laravel Tech Community
Laravel Tech Community
Laravel Tech Community
PHP Kafka Client Library (longlang/phpkafka) Overview

Introduction

PHP Kafka client library, compatible with PHP‑FPM and Swoole environments.

The communication protocol structure is generated from the Java version's JSON files, making this possibly the PHP Kafka client with the most supported message types, covering all 50 APIs.

Message production and consumption are currently implemented, but the component is still in development and testing.

Features

Support for all 50 APIs

Message compression support (gzip, snappy, lz4, zstd)

Intelligent environment detection for PHP‑FPM and Swoole

Producer class

Consumer class

SSL encrypted communication

SASL authentication

Additional feature encapsulation and test case development

Environment Requirements

PHP >= 7.1

Kafka >= 1.0.0

Swoole >= 4.5 (optional)

Installation

composer require longlang/phpkafka

backendKafkamessage queuephpClient
Laravel Tech Community
Written by

Laravel Tech Community

Specializing in Laravel development, we continuously publish fresh content and grow alongside the elegant, stable Laravel framework.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.