start-point/etcd-php
PHP client for etcd v3 with a simple API for KV operations, leases, and authentication/roles/users. Install via Composer and connect to an etcd endpoint to put/get/delete keys, query prefixes, manage leases, and handle auth tokens.
config() with Etcd-backed values (e.g., database URLs, API endpoints) for blue-green deployments or A/B testing.json_decode without strict typing).| Risk Area | Severity | Mitigation Strategy |
|---|---|---|
| API Compatibility | High | Test against Etcd v3.5+ in staging; fork if critical features (e.g., watch prefixes) are missing. |
| Security Vulnerabilities | High | Enforce TLS 1.2+, audit for PHP deserialization risks, and monitor for CVEs. |
| Maintenance Burden | High | Plan for internal patches or migration to a maintained alternative (e.g., etcd3 gRPC client). |
| Performance Bottlenecks | Medium | Benchmark against raw gRPC or Redis for latency-sensitive use cases. |
| Laravel Integration | Medium | Build abstraction layers (e.g., facades, repositories) to isolate Etcd logic. |
| Etcd Cluster Reliability | High | Deploy multi-node Etcd clusters with automatic failover and health checks. |
etcd3 package) for lower latency.Etcd\Client as a singleton in AppServiceProvider:
$this->app->singleton(\Etcd\Client::class, function ($app) {
return new \Etcd\Client(
config('etcd.host'),
config('etcd.port'),
config('etcd.tls.enabled') ? [
'verify_peer' => true,
'cafile' => config('etcd.tls.ca_cert'),
] : []
);
});
config() with Etcd-backed values using a custom repository:
class EtcdConfigRepository implements ConfigRepositoryInterface {
public function get(string $key, $default = null) {
$client = app(\Etcd\Client::class);
$value = $client->get("config/{$key}");
return $value ? json_decode($value, true) : $default;
}
}
Illuminate\Contracts\Cache\Store to delegate to Etcd (with TTL support):
class EtcdCacheStore implements Store {
public function get($key, $default = null) {
$client = app(\Etcd\Client::class);
$value = $client->get("cache/{$key}");
return $value ? json_decode($value, true) : $default;
}
public function put($key, $value, $seconds = null) {
$client = app(\Etcd\Client::class);
$options = $seconds ? ['lease' => $client->grant($seconds)] : [];
$client->put("cache/{$key}", json_encode($value), $options);
}
}
$client->put('/services/api/v1', json_encode(['host' => '10.0.0.1', 'port' => 8000]));
$client->watch('/services/api/v1', function ($event) {
// Reroute traffic or trigger reloads
});
$client->put('/deployments/api/v1', 'v1.2.3');
composer require start-point/etcd-php.facade(Etcd::class, \App\Facades\Etcd::class);
Etcd::watch('config/feature_flags', function ($event) {
Cache::forget('feature_flags');
Cache::put('feature_flags', json_decode($event->value, true));
});
Cache system to use Etcd as a secondary store.How can I help you explore Laravel packages today?