PHPackages                             indigerd/php-consul-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. indigerd/php-consul-sdk

ActiveSdk[API Development](/categories/api)

indigerd/php-consul-sdk
=======================

PHP Consul SDK.

v1.2.2(7y ago)04.0k1MITPHP

Since May 11Pushed 7y ago1 watchersCompare

[ Source](https://github.com/Indigerd/php-consul-sdk)[ Packagist](https://packagist.org/packages/indigerd/php-consul-sdk)[ RSS](/packages/indigerd-php-consul-sdk/feed)WikiDiscussions master Synced yesterday

READMEChangelog (4)Dependencies (3)Versions (6)Used By (0)

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

[](#consul-sdk)

Usage
-----

[](#usage)

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

```
$factory = new \indigerd\consul\ServiceFactory();
/* @var \indigerd\consul\services\ServiceKeyValue $kv */
$kv = $factory->get('kv');

$model = new \indigerd\consul\models\KeyValue();

$model->setKey('test-value');
$model->setValue('Some test content');

$kv->setKeyValue($model);

$v = $kv->getKeyValue($model->getKey());

/* @var \indigerd\consul\services\ServiceRegistry $registry */
$registry = $factory->get('registry');

$service = new \indigerd\consul\models\Service();
$service->setName('TestMicroService');
$service->setAddress('192.168.44.177');
$service->setPort(80);
$registry->register($service);

/* @var \indigerd\consul\services\ServiceDiscovery $discovery */
$discovery = $factory->get('discovery');

$address = $discovery->getServiceAddress($service->getName());

class ConsulHeartBeatCommand
{
    const EXIT_CODE_NORMAL = 0;
    const EXIT_CODE_ERROR = 1;
    const EXIT_CODE_CONSUL_HEARTBEAT_FAIL = 2;

    public $defaultAction = 'respond';

    public function run($name, $id = '')
    {
        $service = new \indigerd\consul\models\Service();
        $service->setName($name);
        if (!empty($id)) {
            $service->setId($id);
        }
        $factory = new \indigerd\consul\ServiceFactory();
        $heartBeat = $factory->get('health');
        $heartBeat->addHealthCheck(function () {
            return (4 === 2 + 2);
        });
        try {
            $health = $heartBeat->run($service);
        } catch (\Exception $e) {
            $health = false;
        }
        if ($health) {
            return self::EXIT_CODE_NORMAL;
        }
        return self::EXIT_CODE_CONSUL_HEARTBEAT_FAIL;
    }
}

$command = new ConsulHeartBeatCommand;

$health = $command->run($service->getName());
```

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 50% 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

5

Last Release

2766d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a703c1aca573c9decd6f315c7bf25ae11e8e63120318c97c6ce4819133080ac8?d=identicon)[Indigerd](/maintainers/Indigerd)

---

Top Contributors

[![Indigerd](https://avatars.githubusercontent.com/u/2143512?v=4)](https://github.com/Indigerd "Indigerd (3 commits)")[![indigerd-tm](https://avatars.githubusercontent.com/u/18114480?v=4)](https://github.com/indigerd-tm "indigerd-tm (3 commits)")

---

Tags

sdkheartbeatMicroserviceconsul

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[openai-php/laravel

OpenAI PHP for Laravel is a supercharged PHP API client that allows you to interact with the Open AI API

3.7k7.6M74](/packages/openai-php-laravel)[temporal/sdk

Temporal SDK

4002.2M18](/packages/temporal-sdk)[friendsofphp/consul-php-sdk

SDK to talk with consul.io API

316230.5k5](/packages/friendsofphp-consul-php-sdk)[leapfu/cloud-printer

高扩展性云小票打印SDK，支持飞鹅云、芯烨云、易联云、快递100、映美云、佳博云、中午云、优声云等主流云打印服务，兼容 Laravel、ThinkPHP 等主流框架，统一API，易集成，易扩展。

104.5k](/packages/leapfu-cloud-printer)

PHPackages © 2026

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