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.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package consul-php-sdk

Consul PHP SDK

A thin, no-magic PHP wrapper around the Consul HTTP API, built on top of Symfony HttpClient.

โœจ Features

๐Ÿ“ฆ Installation

๐Ÿš€ Usage

Configuration

By default, services talk to the agent on http://127.0.0.1:8500. The address can be changed with the CONSUL_HTTP_ADDR environment variable (the same one the Consul CLI uses), or with the base_uri option:

The first argument of Client accepts any Symfony HttpClient option, which comes handy to send an ACL token:

The token can also be set with the CONSUL_HTTP_TOKEN environment variable.

You can also pass a PSR-3 logger, and your own HttpClientInterface instance:

Available services

Service Consul API
Consul\Services\ACL /v1/acl
Consul\Services\Agent /v1/agent
Consul\Services\Catalog /v1/catalog
Consul\Services\Config /v1/config
Consul\Services\Connect /v1/connect
Consul\Services\Coordinate /v1/coordinate
Consul\Services\DiscoveryChain /v1/discovery-chain
Consul\Services\Event /v1/event
Consul\Services\Health /v1/health
Consul\Services\KV /v1/kv
Consul\Services\Operator /v1/operator
Consul\Services\Peering /v1/peering
Consul\Services\PreparedQuery /v1/query
Consul\Services\Session /v1/session
Consul\Services\Snapshot /v1/snapshot
Consul\Services\Status /v1/status
Consul\Services\TXN /v1/txn

Conventions

All services follow the same convention:

Both exceptions implement Consul\Exception\ConsulExceptionInterface:

๐Ÿณ Cookbook

Register a service with a health check

Read many keys at once

Run a transaction

Back up the cluster

Acquire an exclusive lock

LockHandler takes a lock on a key, and releases it automatically at the end of the script:

Lock many resources at once

MultiLockHandler locks all resources, or none of them:

Use a distributed semaphore

MultiSemaphore allows up to limit concurrent holders per resource. Each Resource is defined by a name, the number of slots to acquire, and a limit:

๐Ÿงฉ Compatibility

Version PHP symfony/http-client
5.4 โ‰ฅ 8.2 6.4, 7.4, 8.1+
5.3 โ‰ฅ 8.1 5.4, 6.4, 7.x, 8.x

Looking for Guzzle support, or older versions of PHP? Check the CHANGELOG and this older README.

๐Ÿงช Running the test suite

The test suite needs a Consul agent listening on localhost:8500 (or on CONSUL_HTTP_ADDR), with ACLs enabled and root as management token. The easiest way is to use Docker:

Then run:

๐Ÿ“„ License

This library is released under the MIT license.


All versions of consul-php-sdk with dependencies

PHP Build Version
Package Version
Requires php Version >=8.2
psr/log Version ^2|^3
symfony/http-client Version ^6.4|^7.4|^8.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package sensiolabs/consul-php-sdk contains the following files

Loading the files please wait ...