PHP client for Etcd v3

V1.1 2017-06-21 06:49 UTC

This package is auto-updated.

Last update: 2020-11-17 01:15:54 UTC


PHP client for Etcd v3

Build Status Latest Stable Version Total Downloads License



  • PHP5.5+
  • Composer


composer require start-point/etcd-php


require 'vendor/autoload.php';
$client = new \Etcd\Client('');

/*********** kv ***********/
// set value
$client->put('redis', '');

// set value and return previous value
$client->put('redis', '', ['prev_kv' => true]);

// set value with lease
$client->put('redis', '', ['lease' => 7587822882194199413]);

// get key value

// get all keys

// get keys with prefix

// delete key

// compaction

/************ lease *****************/


// grant with ID
$client->grant(3600, 7587822882194199413);

// revoke a lease

// keep the lease alive

// retrieve lease information

/************ auth role user **************/

// enable authentication

// disable authentication

// get auth token
$client->authenticate('user', 'password');

// set auth token

// clear auth token

// add a new role

// get detailed role information

// delete a specified role

// get lists of all roles

// add a new user
$client->addUser('user', 'password');

// get detailed user information

// delete a specified user

// get a list of all users.

// change the password of a specified user
$client->changeUserPassword('user', 'new password');

// grant a role to a specified user
$client->grantUserRole('user', 'role');

// revoke a role of specified user
$client->revokeUserRole('user', 'role');

// grant a permission of a specified key or range to a specified role
$client->grantRolePermission('admin', \Etcd\Client::PERMISSION_READWRITE, 'redis');

// revoke a key or range permission of a specified role
$client->revokeRolePermission('admin', 'redis');