caryxiao / php-zookeeper

A PHP extension for interfacing with Apache ZooKeeper

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PHP ZooKeeper Extension

Build Status Coveralls

This extension uses libzookeeper library to provide API for communicating with ZooKeeper service.

ZooKeeper is an Apache project that enables centralized service for maintaining configuration information, naming, providing distributed synchronization, and providing group services.

Requirements

Install

1.Compile ZooKeeper C Binding

$ ./configure --prefix=/path/to/zookeeper-c-binding
$ make
$ sudo make install

2.Compile PHP ZooKeeper Extension

$ phpize
$ ./configure --with-libzookeeper-dir=/path/to/zookeeper-c-binding
$ make
$ sudo make install

Examples

<?php
$zc = new Zookeeper();
$zc->connect('localhost:2181');
var_dump($zc->get('/zookeeper'));
?>

Working with other extensions

1.Swoole

Swoole\Async::set([
    'enable_signalfd' => false, // See: https://github.com/swoole/swoole-src/issues/302
]);

$zk = new Zookeeper('localhost:2181');

Swoole\Process::signal(SIGTERM, function() {
        echo "TERM" . PHP_EOL;
        Swoole\Event::exit();
    });
Swoole\Event::wait();

For Developers

Branches

  • master: Main branch.
  • 0.5.x: The last branch which still supports PHP 5.x.

Resources

About

A PHP extension for interfacing with Apache ZooKeeper

License:Other


Languages

Language:C 64.3%Language:PHP 29.2%Language:Shell 3.4%Language:M4 3.1%