Consul / PHP

Discovery and configin one client

18 API modules, 3 high-level wrappers, synchronous and Promise entry points, six frameworks.

Consu, the consul project pet

Discovery, config, and cluster operations

consul-php covers the Consul HTTP API v1, bringing service registration, discovery, the config center, KV, Session, ACL, and cluster operations into one PHP client.

The core depends only on PSR interfaces, with replaceable HTTP, cache, logging, and events; Laravel, Hyperf, webman, and three more frameworks are built in.

  • Four health check modes
  • Blocking queries and fallback
  • ACL, Session, and snapshots
18API modules
6Framework adapters
594Unit tests
Consu Smile expression

Consu

A registry sidekick that only eats heartbeats and never goes offline: the antenna is the health check heartbeat, the pulse line on its chest is the service status, and the badge on its belt is the ACL Token.

Heartbeat alive, service online.

From registration to service governance

Registration, discovery, config, locks, and operations share one transport.

Registry and discovery

TTL, HTTP, TCP, and gRPC checks, with load balancing across healthy instances.

Hot config reload

Blocking query long polling, fallback polling on errors, and automatic recovery.

Session distributed locks

Create, renew, and destroy sessions, using KV acquire for resource locks.

ACL permissions

Full management of Token, Policy, Role, and AuthMethod.

Cluster operations

Status, Operator, Snapshot, and Event modules are all present.

Six framework adapters

Built-in adapters for Laravel, Hyperf, webman, ThinkPHP, Yii2, and Yii3.

From an API client to service governance

Four releases that filled in modules, native support, and framework adapters.

v4.1.0

Yii2 and Yii3 adapters

Adds the Yii2 application component and Yii3 DI integration, completing six framework adapters.

v4.0.0

18 API modules and native PHP

Deep audit fixes, API modules expanded to 18, and built-in cURL support for native PHP.

v3.3.0

Built-in cURL and lifecycle helpers

Adds a built-in cURL HTTP client and NativeService register, heartbeat, and deregister helpers.

v3.2.0

Multilingual diagrams and artisan commands

Fixes multilingual diagram layout and fills in artisan commands and localization resources.

Changelog

Recent releases; the full list is on GitHub Releases.

Latest v4.1.0 All versions
v4.1.02026-09-29

Adds Yii2 and Yii3 adapters, completing six framework integrations.

v4.0.22026-09-25

Corrects the documentation for ACL and cache.enable.

v4.0.12026-09-25

Fixes module chip overflow in the architecture diagram.

v4.0.02026-09-25

Deep audit fixes, 18 API modules, and native PHP support.

v3.3.02026-09-25

Built-in cURL client and service lifecycle helpers.

v3.2.12026-09-25

Changes the project pet to a standalone pet image.

Install and use

Install first, then run a minimal example.

PHP 8.0+ / PSR-18Full README
Install
composer require erikwang2013/consul-php
Minimal example
use Erikwang2013\Consul\Client\ConsulClient;

$client = new ConsulClient(['base_uri' => 'http://127.0.0.1:8500']);

$instances = $client->serviceDiscovery()->healthyInstances('user-service');
$dbHost = $client->configCenter()->get('app/db_host', 'localhost');

Twelve Consu expressions

Hover for a moment and its mood changes.

Search this site

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