2017 © Pedro Peláez
 

library php-consul-http-client

HTTP-based client for Consul service discovery

image

cascade-energy/php-consul-http-client

HTTP-based client for Consul service discovery

  • Thursday, December 10, 2015
  • by cberube
  • Repository
  • 5 Watchers
  • 0 Stars
  • 52 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

php-consul-http-client

Allows for Consul Service Lookup over HTTP

This module requests all passing consul services with the desired name, and optional version tag, and returns the URL of a randomly selected copy of the service., (*1)

Example:, (*2)

<?php

// Passing `null` as the first argument lets the module create it's own http client
$serviceLookup = new CascadeEnergy\ServiceDiscovery\Consul\ConsulHttp(null,"<ip-of-consul-server>:8500");

// `service-version` is optional
$serviceUrl = $serviceLookup->getServiceAddress(<service-name>, <service-version>);

if ($serviceUrl == null) {
  //If no healthy instances of the desired service are found, the url returned is `null`
  //this can be handled in any convenient manner such as:
  throw new Exception('Service not found!');
} else {
  //The service was found!
  $client = new <insert-your-favorite-http-client-here>();

  $request = $client->put("$url/<route>",null,<body>);

  // keep interacting with the service, ask for urls of new services, etc...
}

The Versions

10/12 2015

dev-master

9999999-dev

HTTP-based client for Consul service discovery

  Sources   Download

MIT

The Requires

 

The Development Requires

by Nick Warlen

10/12 2015

v0.1.0

0.1.0.0

HTTP-based client for Consul service discovery

  Sources   Download

MIT

The Requires

 

The Development Requires

by Nick Warlen

10/12 2015

0.1.x-dev

0.1.9999999.9999999-dev

HTTP-based client for Consul service discovery

  Sources   Download

MIT

The Requires

 

The Development Requires

by Nick Warlen