Kafka client for PHP
Asked Answered
S

2

7

I have a problem with Kafka PHP client on Windows (using xampp). I have installed Apache Kafka 0.8 and tested successfully. Then, I'm finding a PHP client to integrate Kafka to PHP, I just only want to make PHP can produce messages to Kafka (no consume).

By this link: https://cwiki.apache.org/confluence/display/KAFKA/Clients#Clients-PHP I found: https://github.com/EVODelavega/phpkafka

But this PHP Kafka client is being develop and the installation of this extension is more complex (requied librdkafka)

I have tried with other clients but no one work for me.

Does anyone have the same problem with me? Is there simple solution to integrate Kafka to PHP?

Situation answered 21/8, 2015 at 2:27 Comment(3)
Hi, I'm actually developing the phpkafka extension you've linked to in your question. I'm afraid to say that getting it to compile on windows is something that is quite far down on my todo list (the C code is written for C99 compilers, which last I used windows, visual studio did not implement). I also believe that you can't really add extensions to PHP on xampp, or maybe you can't upgrade your PHP version. My advise to you would be: set up a virtual machine that runs linux, and install the extension there. Producing messages on the master version works just fineQuiff
Did you get working php client for PHP?Evadne
Nope, I moved to RabbitMQWickliffe
S
7

IMHO the most active Kafka client for PHP is arnaud-lb/php-rdkafka. I managed to compile and run it successfully on OSX and Linux.

Septuor answered 4/9, 2016 at 8:55 Comment(1)
Yes sure, I also used that php-kafka client arnaud-lb/php-rdkafk yesterday. It works well. It also required to install extension with pecel or manually. You can check in here.Lepage
E
2

Currently (July of 2018) it looks like php-enqueue/enqueue-dev is the leader on github in terms of most stars. It also has the following stats, which are "better" than any of the projects mentioned above, and the latest commit was two days ago.

1,267 commits 24 branches 103 releases 50 contributors

That being said, at the time of this writing, the "build" badge for Kafka says "error", so, you know... caveat lector!

Exertion answered 18/7, 2018 at 23:13 Comment(3)
Library itself is good but maintainer has low knowledge of kafka and enqueue/rdkafka is not really usable due to multiple bugsWeylin
This still depends on arnaud-lb/php-RdKafka which is super buggyTeodoro
Yeah, kafka part of php-enqueue depends on php-rdkafka - which is a wrapper around C library librdkafka. While usable (I use it for both producing and consuming messages) php-rdkafka might not be stable - especially in edge cases. However, it has the benefit of talking directly to kafka broker instead of http endpoint, which makes it a lot faster.Tolentino

© 2022 - 2024 — McMap. All rights reserved.