jcalderonzumba / consul-discovery
Consul service discovery made easy
Installs: 2 211
Dependents: 0
Suggesters: 0
Security: 0
Stars: 5
Watchers: 4
Forks: 2
Open Issues: 0
Type:consul-sdk
Requires
- php: >=5.4
This package is not auto-updated.
Last update: 2024-12-21 20:41:31 UTC
README
Lightweight CONSUL service discovery for PHP
Requirements
You need to have CONSUL agent up and running.
Installation
This library can be installed with composer:
composer require jcalderonzumba/consul-discovery
Usage
The usage depends on the feature of CONSUL you want to use, for the moment we support:
- Service discovery
Service discovery
Discovery of a service was never easier just use:
use Zumba\Consul\Features\Discovery; $discovery = new Discovery([ "consul_url" => "YOUR_CONSUL_HTTP_API" ]); $service = $discovery->getService("pigeon"); echo $service->getID(); echo $service->getAddress(); echo $service->getPort();
By default we search ONLY for healthy service nearest to the agent. If you want this behavior to change open a issue and let's talk about it.
TODO
- TEST, TEST, TEST!!!
- Add more features to the SDK.