Download the PHP package sensiolabs/consul-php-sdk without Composer
On this page you can find all versions of the php package sensiolabs/consul-php-sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download sensiolabs/consul-php-sdk
More information about sensiolabs/consul-php-sdk
Files in sensiolabs/consul-php-sdk
Package consul-php-sdk
Short Description SDK to talk with consul.io API
License MIT
Informations about the package consul-php-sdk
Consul PHP SDK
Consul PHP SDK is a thin wrapper around the Consul HTTP API.
Compatibility
See previous version of README.md to find some version compatible with older version of symfony/http-client or guzzle
Installation
This library can be installed with composer:
composer require friendsofphp/consul-php-sdk
Supported services
- agent
- catalog
- health
- kv
- session
- txn
Usage
Instantiate a services, and start using it:
A service exposes few methods mapped from the consul API:
All services methods follow the same convention:
- All API mandatory arguments are placed as first;
- All API optional arguments are directly mapped from
$someOptions
; - All methods return a
Consul\ConsulResponse
; - If the API responds with a 4xx response, a
Consul\Exception\ClientException
is thrown; - If the API responds with a 5xx response, a
Consul\Exception\ServeException
is thrown.
Cookbook
How to acquire an exclusive lock?
How to use MultiLockHandler?
How to use MultiSemaphore?
Some utilities
Consul\Helper\LockHandler
: Simple class that implement a distributed lockConsul\Helper\MultiLockHandler
: Simple class that implements a distributed lock for many resourcesConsul\Helper\MultiSemaphore
: Simple class that implements a distributed semaphore for many resources
Run the test suite
You need a consul agent running on localhost:8500
.
But you ca override this address:
If you don't want to install Consul locally you can use a docker container:
Then, run the test suite