- How do I install mateusjunges/laravel-kafka in a Laravel app?
- Install it with Composer, then publish the package configuration and set your broker list, consumer group, and serializers. You will also need the rdkafka PHP extension available in the environment running Laravel. After that, Kafka::publish() calls and the kafka:consume worker work without extra wiring.
- Does laravel-kafka support Laravel 10 and PHP 8.1?
- The package tracks recent Laravel releases but drops old ones; Laravel 8 and PHP 8.0 support were removed, and Laravel 10 support was added in early 2023. Check the current composer.json and changelog for the exact Laravel and PHP matrix before adopting. Treat it as a moving target and verify it matches your roadmap.
- Do I need the rdkafka PHP extension for laravel-kafka?
- Yes. The package is a Laravel facade over ext-rdkafka, so the PECL rdkafka extension built against librdkafka must be installed in every runtime and build image. That includes Alpine/musl and ARM64 targets, where builds can be more involved. Plan for native dependency management in CI and deployment.
- How do I consume Kafka messages in Laravel with laravel-kafka?
- Define a consumer with topic and group configuration, attach a message handler, and run the Artisan kafka:consume worker as a long-running process. It handles graceful shutdown signals such as SIGTERM and SIGQUIT and exposes onStopConsume hooks. This is separate from queue:work and Horizon, so run it under Supervisor, systemd, or a container sidecar.
- How do I test Kafka producers and consumers in Laravel?
- The package is built with testing in mind and provides consumer mocks, batch mocks, and publish assertions such as assertPublishedOnTimes. That lets you verify Kafka interactions inside Laravel's normal test suite without a live broker. Its own tests run against a Dockerized Kafka, which is a good signal for reproducible CI.
- Can I use laravel-kafka with Laravel queues or Horizon?
- No. Laravel Kafka is a parallel transport and is not a queue driver, so you cannot run it through queue:work or Horizon. Producers are simple two-line Kafka::publish() calls, but consumers need their own long-running process model. If your platform standardizes on Redis or Horizon semantics, this package is a poor fit.
- How do I configure SASL and SSL authentication in laravel-kafka?
- Configuration covers broker connectivity and SASL/SSL material, but the changelog shows historical SASL and auto_commit defects, so test authentication paths carefully. Provision topics and ACLs separately and keep credentials out of source control. Verify the exact config keys against laravelkafka.com for your installed version.
- Does laravel-kafka support exactly-once delivery?
- The documentation does not surface a first-class exactly-once or idempotent-producer story, so assume at-least-once delivery. Design handlers to be idempotent and tolerate duplicates and redelivery. If you need stronger guarantees, confirm with the maintainer and test against your broker configuration.
- How do I run the kafka:consume worker in production?
- Run kafka:consume as a supervised long-running process separate from PHP-FPM, using Supervisor, systemd, or a container sidecar. The package handles SIGTERM and SIGQUIT and provides onStopConsume so deployments can shut down cleanly. Monitor consumer lag, rebalances, and offset commits, since correctness is largely delegated to librdkafka.
- Is mateusjunges/laravel-kafka actively maintained and what are the alternatives?
- Alternatives include using ext-rdkafka directly, other Laravel Kafka wrappers, or delegating consumption to a polyglot service while keeping PHP producer-only. mateusjunges/laravel-kafka is MIT licensed, has a real changelog and roughly 736 GitHub stars, but is effectively maintained by one person with no LTS or SLA. Budget for fork risk or a fallback to direct rdkafka usage.