This repository has PHP examples for Kafka consumers / producers for:
- php-rdkafka: Examples just using the PHP extension
- php-kafka-lib: PHP library that relies on php-rdkafka and supports avro
Be sure to start the docker containers.
To do so, run this in the project root:
docker-compose up -d
docker-compose exec php bash
Then follow the instructions in the example folders.
If you wan't to test / debug something that is closer to your setup,
you can modify the following arguments in docker-compose.yml
:
PHP_IMAGE_TAG: 7.4-cli-alpine3.11
LIBRDKAFKA_VERSION: v1.4.0
PHP_RDKAFKA_VERSION: 4.0.3
Adjust those, to reflect your setup and afterwards run:
docker-compose up --build -d