Download the PHP package siberfx/apache-kafka without Composer
On this page you can find all versions of the php package siberfx/apache-kafka. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download siberfx/apache-kafka
More information about siberfx/apache-kafka
Files in siberfx/apache-kafka
Package apache-kafka
Short Description Apache Kafka Service Helper
License MIT
Homepage https://github.com/siberfx/apache-kafka
Informations about the package apache-kafka
Apache Kafka Queue Service for Laravel 12.x 13.x
A Laravel queue driver backed by Apache Kafka (tested against
Confluent Cloud). It lets you dispatch Laravel jobs to a Kafka
topic and process them with the standard queue:work worker.
Requirements
- PHP
^8.4 - Laravel
^12.0 | ^13.0 - The
rdkafkaPHP extension (built on top oflibrdkafka) - A reachable Kafka cluster (self-hosted or Confluent Cloud)
Required before starting
If you are using Confluent Cloud, create an account at https://www.confluent.io/, create a new project and provision an "Apache Kafka on Confluent Cloud" cluster, then create an API key/secret that will be used as the SASL username/password below.
Make sure the rdkafka extension is installed and enabled before installing the package:
Installation
1. Install the rdkafka PHP extension
A ready-to-use container is provided under
docker/(PHP 8.4 withlibrdkafkaandrdkafkaalready compiled). Run it withdocker compose -f docker/docker-compose.yaml up.
2. Require the package via Composer
The service provider (Siberfx\Kafka\KafkaServiceProvider) is auto-discovered — no manual
registration required.
Configuration
1. Add a kafka connection to config/queue.php
The connector reads its settings from the queue connection config. Add the following entry under
connections:
2. Set your .env
For a local, unauthenticated broker use
KAFKA_SECURITY_PROTOCOL=PLAINTEXTand leave the SASL values empty.
3. (Optional) Publish the package config
This publishes config/kafka-config.php, which you can use to hold your own Kafka-related
values. Note that the queue driver itself is configured from config/queue.php (step 1).
Usage
Define a job
Dispatch a job
Run the worker
The worker subscribes to the given Kafka topic and processes incoming messages:
Pushing a raw job
You can also push directly through the Queue facade:
Limitations
This driver implements the core produce/consume path. The following are not yet supported:
- Delayed dispatch —
->delay()/later()is a no-op; messages are produced immediately or not at all. - Queue size —
size()is not implemented, soqueue:monitorand size-based logic won't work. - Failed jobs & retries —
pop()calls the job'shandle()directly and does not integrate with Laravel'sfailed_jobs, retry, or release mechanisms. A throwing job is logged, not retried. - Trusted payloads only — consumed messages are unserialized into job objects. Restrict write access to your topics to your own applications.
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see the composer.json for license details.