Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Quourtige's avatar

How to use Kafka in place of Redis as a real-time processing in Laravel

Hello everyone,

I'm using Vuejs + Laravel APIs + Kafka + Mysql for an application that processes data from IIoTs and will display real-time data on the front end. I have been successful in consuming data from Kafka but now I want to use socket io as a real-time tech.

However, from what I saw, I found that developers mostly use Redis for real-time processing, I know it's an in-memory database so it is fast but I'm already using Kafka and I don't really need that speed in real-time processing so I decided to not add another tech to the stack.

The problem is how I will use Kafka in place of Redis, in the '.env' file:

REDIS_HOST=127.0.0.1 REDIS_PASSWORD=null REDIS_PORT=6379

Do I need to simply add my Kafka broker information or do I need to do more? Or maybe you suggest using Redis for some reason.

Please I just need guidance because all the tutorials use Redis.

0 likes
2 replies
martinbean's avatar
Level 80

@quourtige I’m not sure what you’re asking. Laravel doesn’t have built-in support for Kafka. You can’t just put Kafka credentials in place of Redis credentials and Laravel’s Redis driver to start magically working.

If you want to use web sockets then you’ll probably need to publish messages from your Kafka instance to a socket channel, and then consume messages from those socket channels on your front-end. So Laravel actually has no bearing on how you use Kafka or sockets because it won’t be involved in the process at all.

1 like
Quourtige's avatar

Thanks for your answer.

Yes, as you said I just found that Laravel doesn't support Kafka as a broadcasting system as in the 'broadcasting.php' file

| Supported: "pusher", "ably", "redis", "log", "null"

not just that even socket io doesn't have a Kafka adapter (you need to build it yourself).

Well, no problem I will use Redis in this case.

Please or to participate in this conversation.