teamones/etcd-discovery
A Laravel package that integrates etcd for service registration and discovery, letting applications dynamically locate and connect to available service instances. It simplifies distributed service configuration and load-balanced endpoint resolution.
Monolith-to-service-split sequencing. Whether to carve a PHP application into independently deployable services hinges on whether those services can find each other at runtime without hardcoded host lists. This package is the piece that makes dynamic addressing possible for Workerman-based PHP services on an etcd backbone — so it is a gating dependency for a services roadmap, not a standalone feature.
Build vs. buy on service discovery. The alternative is hand-rolling a registry (a database table of hosts plus a cron sweeper plus a client-side poller) — typically 2–4 engineer-weeks plus permanent on-call exposure for a component nobody owns. Adopting this package reframes the decision from "build a registry" to "operate etcd," which is a far more standard competency.
Runtime and transport standardization. ETCD-based registration effectively preselects a long-running process model (Workerman/Swoole/webman/Octane) and points toward RPC-style transports (gRPC, JSON-RPC over TCP) rather than HTTP-per-request FPM. That is a multi-quarter architectural commitment and should be made deliberately, with this package as the concrete proof point in the design doc.
Rollout strategy features. Registry metadata is the natural carrier for weighted routing, blue/green cutover, and canary percentages without a service mesh. If the roadmap contains progressive delivery, this belongs in the "enabling infrastructure" line item rather than being deferred behind a gateway project.
Deployment and reliability OKRs. Graceful shutdown, lease TTL, and health-check semantics directly set achievable targets for "zero-downtime deploys" and "no 502s during scale events." The package's lease/deregistration behavior determines whether those OKRs are realistic or aspirational.
Vendor and platform choice. If the org is evaluating Nacos, Consul, or Kubernetes-native discovery, a working PHP client for etcd is a data point in that comparison — it removes "no viable PHP story" as an argument against etcd.
Use cases worth validating first: internal service-to-service calls between Workerman workers, gRPC-PHP backends, multi-tenant routing keyed on registry metadata, and sidecar-free environments (bare metal, VMs, Docker Compose) where Kubernetes DNS is unavailable.
Adopt-pilot criteria:
ServiceRegistry interface so it is replaceable.Look elsewhere when:
To executives: This is small, unglamorous plumbing that unlocks something larger. It lets PHP services announce themselves and find each other automatically, which is what makes horizontal scaling, zero-downtime deploys, and independent team releases possible without hand-maintained server lists. The strategic value is optionality: it commits us to a well-understood open-source coordination system (etcd) instead of a bespoke registry we would own forever. The caveat is candid: this library is a young, single-maintainer open-source project with essentially no adoption. I am not recommending we depend on it as-is — I am recommending a time-boxed spike to validate the approach, with the understanding that we may adopt the pattern and vendor or fork the code. Cost is measured in days, not quarters; the risk is contained and the architectural payoff is real.
To engineering: Treat this as a reference implementation and a shape for the design, not a finished dependency. It demonstrates the etcd lease-register-keepalive-deregister loop inside a Workerman event loop, which is the part everyone gets wrong. Before committing, we should audit: etcd API version compatibility (v3 leases and watches, not v2), reconnect and watch-resubscribe behavior under etcd leader election, behavior when the event loop blocks, graceful-shutdown deregistration timing versus in-flight requests, and whether the client dependency is maintained. My recommendation is to pin it, wrap it behind our own registry interface with a static-config fallback, and assume we own the code within two quarters. If the spike shows the internals are thin, we fork — the surface area is small enough that owning it is cheaper than the integration risk of depending on it.
How can I help you explore Laravel packages today?