PHP extension for Apache Kafka 0.8. It's built on top of kafka C driver (librdkafka). It makes persistent connection to kafka broker with non-blocking calls, so it should be very fast.
IMPORTANT: Library is in heavy development and some features are not implemented yet.
Download and install librdkafka. Run sudo ldconfig
to update shared libraries.
phpize
./configure --enable-kafka
make
sudo make install
sudo sh -c 'echo "extension=kafka.so" >> /etc/php5/conf.d/kafka.ini'
#For CLI mode:
sudo sh -c 'echo "extension=kafka.so" >> /etc/php5/cli/conf.d/20-kafka.ini'
// Produce a message
$kafka = new Kafka("localhost:9092");
$kafka->produce("topic_name", "message content");