The first step, import nmred/kafka-php with composer.json.
"require": { ..., "nmred/kafka-php": "0.1.*" },
And you need to install the zookeeper environment on your machine. By executing the following
yum --nogpgcheck localinstall -y https://archive.cloudera.com/cdh5/one-click-install/redhat/7/x86_64/cloudera-cdh-5-0.x86_64.rpm yum install -y zookeeperThis allows you to access cdh5 rpm and install zookeeper client on the machine.
But your php still not have the zookeeper.so to make php communicate with zookeeper. So now we need to generate the zookeeper.so. By the following
yum install -y php-devel # this enables phpize cd /tmp wget http://apache.stu.edu.tw/zookeeper/zookeeper-3.4.9/zookeeper-3.4.9.tar.gz # the zookeeper source tar zxvf zookeeper-3.4.9.tar.gz cd /tmp/zookeeper-3.4.9/src/c # source of c lang ./configure --prefix=/usr/local/zookeeperlib # configure the environment of libzookeeper make && make install cd /tmp wget https://pecl.php.net/get/zookeeper-0.3.1.tgz # download the php-zookeeper source tar zxvf zookeeper-0.3.1.tgz cd zookeeper-0.3.1 phpize ./configure --with-php-config=/usr/bin/php-config --with-libzookeeper-dir=/usr/local/zookeeperlib/ # setup the environment make && make install # install zookeeper.so echo '; zookeeper' >> /etc/php.ini echo 'extension=zookeeper.so' >> /etc/php.ini # attach the zookeeper.so information cd /tmp rm -rf zookeeper-3.4.9 rm -rf zookeeper-0.3.1Notice that, choose the php-zookeeper wisely. Make sure the version of library you use matches your php version. For example, I use 0.3.1 because the project is a php70 project.