PHP / etcd v3

etcd insideyour PHP process

Eight API domains, HTTP and gRPC transport, and six frameworks out of the box.

Etchy the little elephant, the etcd project pet

The client covers every etcd v3 API

EtcdClient exposes accessors for eight subsystems: KV, Watch, Lease, Auth, Cluster, Maintenance, Election and Lock.

The HTTP path picks curl, PHP streams or PSR-18; Laravel, Hyperf, ThinkPHP, Webman, Yii2 and Yii3 work out of the box.

  • Eight API domains
  • HTTP and gRPC
  • Six framework adapters
8API domains
6Framework adapters
v1.5.0Current version
Etchy the little elephant Smile expression

Etchy

A blue elephant wearing a three-node Raft cluster, with k/v and rev tags on its trunk: the PHP etcd v3 client mascot.

Reconnect when dropped, clean up when expired.

Eight subsystems, each with one job

Every subsystem does one thing, with clear error boundaries.

KV and transactions

Key, prefix and range queries, atomic CAS, nested transactions; compact reclaims history.

Watch

Watch a key or prefix, auto-resubscribe from lastRevision + 1, and cancel through WatchHandle.

Lease

grant, keepAlive, timeToLive and revoke, with expired keys cleaned up automatically.

Auth

Manage users, roles and permissions; credentials fetch tokens and 401 responses re-authenticate.

Cluster and maintenance

Add or remove members, promote learners, read status, defrag, and stream sha256-checked snapshots.

Election and lock

Run elections and watch the leader; Lock uses leases and releases after SIGKILL.

One release, one capability

From transport fallbacks to framework adapters, every step is a real commit.

v1.5.0

Yii2 and Yii3 adapters

Add two Yii adapters, completing six frameworks: Laravel, Hyperf, ThinkPHP, Webman, Yii2 and Yii3.

v1.4.0

Election, locks and gRPC

Add Election, Lock, snapshotTo and watch cancellation; land unary gRPC RPCs.

v1.3.0

Fixing defects against a real cluster

Fix broken Watch, 400s on no-argument methods and keepAlive always throwing; rebuild the test suite.

v1.2.0

No extension required

Add a native PHP stream fallback to the HTTP transport, so ext-curl and PSR-18 are optional.

Changelog

Recent releases, with the full list on GitHub Releases.

Latest v1.5.0 All versions
v1.5.02026-09-29

Add Yii2 and Yii3 adapters; the architecture diagram grows to six adapters.

v1.4.12026-09-26

Sync docs on eight API domains, Election and Lock cards, and real-cluster validation.

v1.4.02026-09-26

Add Election, Lock, snapshotTo and watch cancellation; unary gRPC lands.

v1.3.02026-09-25

Fix a batch of defects against real etcd and rebuild the test defenses.

v1.2.02026-09-25

HTTP transport gains a native PHP fallback, so ext-curl and PSR-18 are optional.

v1.1.02026-09-25

Set the release policy: public API changes go to minor, and reissue v1.1.0.

Install and use

Install, then run a minimal example.

PHP >= 8.1Full README
Install
composer require erikwang2013/etcd
Minimal example
use Erikwang2013\Etcd\EtcdClient;

$etcd = new EtcdClient(['endpoints' => ['127.0.0.1:2379']]);

$etcd->kv()->put('/app/config', '{"debug":true}');
$result = $etcd->kv()->get('/app/config');
print_r($result['kvs'][0]);

Etchy's 12 expressions

Hover and the mood changes.

Search this site

Try “upload”, “migration” or “JWT”.