dcarbone/php-consul-api
PHP client for the Consul HTTP API. Built for Composer and modeled after HashiCorp’s Go client, with version compatibility guidance and flexible configuration (defaults from Consul env vars or custom config with Guzzle, address, scheme, datacenter, auth, tokens).
service:failed) can still trigger Laravel events/listeners or queued jobs.spatie/laravel-consul or other alternatives. The package remains the most actively maintained option for raw Consul API access.Http facade.composer.json for updated PHP version constraints..env are still recommended for Consul outages.$this->app->singleton(ConsulClient::class, function ($app) {
return new ConsulClient('http://consul:8500', ['token' => $app['config']['consul.token']]);
});
cache()->remember()) remain applicable.phpVersion in composer.json is updated to ^8.1.composer.json for:
"require": {
"php": "^8.1"
}
phpVersion before installing the package.null returns).?array instead of null).spatie/fractal) still recommended.| Failure | Impact | Mitigation |
|---|---|---|
| Consul Cluster Down | Service discovery fails | Fallback to static configs in .env |
| Network Partition | Timeouts on API calls | Retry with exponential backoff |
| ACL Token Revoked | All API calls fail | Auto-rotate tokens via Laravel scheduler |
| KV Config Corruption | Invalid app settings | Validate configs with Laravel’s booted |
| High Consul Latency | Slow service resolution | Local cache + stale-while-revalidate |
| PHP 8.1+ Strict Typing | Runtime errors if not compliant | Audit codebase for null returns |
How can I help you explore Laravel packages today?