friendsofphp/consul-php-sdk
A thin PHP wrapper around the Consul HTTP API, covering agent, catalog, health, kv, session, and txn services. It returns ConsulResponse objects, throws typed exceptions, and includes helpers for locks and semaphores.
LockHandler, MultiLockHandler, MultiSemaphore) are the highest-leverage part of the package for a PM, because they convert "distributed locking" from an engineering epic into a small, testable increment. That supports a phased roadmap: (1) config/KV + service discovery, (2) leader election and exclusive jobs via sessions and locks, (3) throttled/concurrency-limited workers via semaphores, (4) service mesh and cross-cluster work.MultiSemaphore with per-resource limits lets you promise "at most N concurrent syncs per tenant" as a product guarantee rather than an aspiration — and the 5.4.0 fix for multi-resource acquisition means that guarantee actually holds across many resources.Snapshot service makes "we can back up and restore our coordination state" an automated, auditable capability from application tooling. That is a concrete deliverable for a SOC2/ISO control narrative rather than a manual runbook item owned by one person.Peering plus dc support on all non-agent-local endpoints means multi-region or hybrid rollouts can be scripted from PHP. This moves "expand to a second region" from an unestimated platform project into a scoped application-team workstream.config/consul.php, no facades. Adoption implies a small but real internal package (provider + config + a health-check wrapper). Size it as a 1–2 day task and assign an owner; otherwise it silently becomes everyone's and no one's.symfony/http-client ≥ 6.4, and psr/log ≥ 2 are floors on a nominally minor release. Treat "adopt this SDK" and "upgrade the runtime" as one work item with one owner and one deadline, or the upgrade will surface mid-sprint as a lockfile conflict.Consul\Services\* directly throughout the codebase.Adopt if:
CONSUL_HTTP_TOKEN standard-env token handling to match your container and CI conventions.Look elsewhere if:
ACL service here is CE ACLs, not enterprise governance — do not let this package create the impression that enterprise controls are covered.symfony/http-client 5.4, or psr/log 1.x. Stay on 5.3; 5.4 will not install, and forcing it will cascade into a broader framework upgrade.Before committing, verify:
For executives: We need three things that are currently hand-built or missing — reliable service discovery as we split the monolith, a guarantee that scheduled jobs and syncs don't run twice, and a backup story for the coordination layer everything depends on. This package is a small, MIT-licensed, actively maintained library from the FriendsOfPHP/Symfony ecosystem that covers all three with about a day of integration work on our side. The cost is not the library; it is a runtime upgrade to PHP 8.2, which we have on the roadmap anyway and should now schedule deliberately rather than discover mid-sprint. The main risk is operational: adopting this means committing to running Consul well, with a named owner.
For engineering: It is a thin wrapper over Consul's HTTP API with consistent method signatures, typed 4xx/5xx exceptions, and full coverage of the Consul CE API as of v5.4.0 — including blocking queries, consistency modes, and multi-valued options as first-class arguments. The genuinely useful part is the helper layer: LockHandler, MultiLockHandler, and MultiSemaphore give us distributed locks and concurrency limits without writing our own session/acquire/release logic. Two caveats: it is framework-agnostic, so we write our own service provider and config; and it has near-zero external dependents, so we should route calls through a single internal adapter class rather than referencing Consul\Services\* throughout the codebase, keeping the swap cost low. Budget the PHP 8.2 and symfony/http-client upgrade as part of the same ticket.
How can I help you explore Laravel packages today?