PHPackages                             caradvice/consul-php-sdk - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. caradvice/consul-php-sdk

ActiveLibrary[API Development](/categories/api)

caradvice/consul-php-sdk
========================

SDK to talk with consul.io API

v1.2.1(9y ago)047MITPHP

Since Dec 8Pushed 9y ago3 watchersCompare

[ Source](https://github.com/caradvice/consul-php-sdk)[ Packagist](https://packagist.org/packages/caradvice/consul-php-sdk)[ RSS](/packages/caradvice-consul-php-sdk/feed)WikiDiscussions master Synced 6d ago

READMEChangelog (3)Dependencies (2)Versions (5)Used By (0)

Consul SDK
==========

[](#consul-sdk)

Compatibility
-------------

[](#compatibility)

This table shows this SDK compatibility regarding Guzzle version:

SDK VersionGuzzle Version1.x&gt;=4, &lt;62.x6Installation
------------

[](#installation)

This library can be installed with composer:

```
composer require sensiolabs/consul-php-sdk

```

Usage
-----

[](#usage)

The simple way to use this SDK, is to instantiate the service factory:

```
$sf = new SensioLabs\Consul\ServiceFactory();

```

Then, a service could be retrieve from this factory:

```
$kv = $sf->get('kv');

```

Then, a service expose few methods mapped from the consul [API](https://consul.io/docs/agent/http.html):

```
$kv->put('test/foo/bar', 'bazinga');
$kv->get('test/foo/bar', ['raw' => true]);
$kv->delete('test/foo/bar');

```

All services methods follow the same convention:

```
$response = $service->method($mandatoryArgument, $someOptions);

```

- All API mandatory arguments are placed as first;
- All API optional arguments are directly mapped from `$someOptions`;
- All methods return raw guzzle response.

So if you want to acquire an exclusive lock:

```
// Start a session
$sessionId = $session->create()->json()['ID'];

// Lock a key / value with the current session
$lockAcquired = $kv->put('tests/session/a-lock', 'a value', ['acquire' => $sessionId])->json();

if (false === $lockAcquired) {
    $session->destroy($sessionId);

    echo "The lock is already acquire by another node.\n";
    exit(1);
}

echo "Do you jobs here....";
sleep(5);
echo "End\n";

$kv->delete('tests/session/a-lock');
$session->destroy($sessionId);

```

Available services
------------------

[](#available-services)

- agent
- catalog
- health
- kv
- session

Some utilities
--------------

[](#some-utilities)

- Lock handler: Simple class that implement a distributed lock

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 84.2% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~222 days

Total

4

Last Release

3599d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/311251bff9b30184fcdaa12857975bcd0b7dcd9b409fe37e428bec2a19681f12?d=identicon)[developerdino](/maintainers/developerdino)

![](https://avatars.githubusercontent.com/u/493126?v=4)[Jordan](/maintainers/jordie)[@jordie](https://github.com/jordie)

---

Top Contributors

[![lyrixx](https://avatars.githubusercontent.com/u/408368?v=4)](https://github.com/lyrixx "lyrixx (16 commits)")[![jippi](https://avatars.githubusercontent.com/u/22841?v=4)](https://github.com/jippi "jippi (1 commits)")[![romainneutron](https://avatars.githubusercontent.com/u/137574?v=4)](https://github.com/romainneutron "romainneutron (1 commits)")[![tusharkant](https://avatars.githubusercontent.com/u/12033035?v=4)](https://github.com/tusharkant "tusharkant (1 commits)")

### Embed Badge

![Health badge](/badges/caradvice-consul-php-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/caradvice-consul-php-sdk/health.svg)](https://phpackages.com/packages/caradvice-consul-php-sdk)
```

###  Alternatives

[laravel/framework

The Laravel Framework.

34.9k556.2M21.3k](/packages/laravel-framework)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.5k6.0M776](/packages/sylius-sylius)[tempest/framework

The PHP framework that gets out of your way.

2.3k37.6k20](/packages/tempest-framework)[avalara/avataxclient

Client library for Avalara's AvaTax suite of business tax calculation and processing services. Uses the REST v2 API.

528.7M7](/packages/avalara-avataxclient)[drupal/core

Drupal is an open source content management platform powering millions of websites and applications.

19467.3M1.9k](/packages/drupal-core)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

762297.9k52](/packages/civicrm-civicrm-core)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
