2017 © Pedro PelĂĄez
 

library etcd-php

Etcd client library for PHP

image

datingvip/etcd-php

Etcd client library for PHP

  • Wednesday, March 21, 2018
  • by kornrunner
  • Repository
  • 7 Watchers
  • 1 Stars
  • 31 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 3 % Grown

The README.md

Etcd PHP Client

etcd is a distributed configuration system, part of the coreos project., (*1)

This repository provides a client library for etcd for PHP applications. Inspired by linkorb/etcd-php. For our purpose, we need a more elastic version for etcd client. It can use with predefined HTTP client (no matter what it is) and also supports PHP 7.1., (*2)

The etcd-php uses curl library as a default client and creates own instance of http client., (*3)

Installating etcd

To install etcd, follow instructions that etcd team posts on Releases page of the project:, (*4)

https://github.com/DatingVIP/etcd/releases/, (*5)

Installing DatingVIP/etcd

Easiest way is to install it using composer:, (*6)

{
    "require" : {
        "DatingVIP/etcd": "^1.0"
    }
}

Using Client

use use DatingVIP\Component\Etcd\Client;

$client = new Client('http://127.0.0.1:4001');

// If you have own http client object & if it has proper adapter 
// proper means - need to implement DatingVIP\Component\Etcd\Client\HttpInterface)
$httpAdapter = new MyAdapter($myHttpClient);
$client->setHttpClient($httpAdapter);

// Get, set, update, remove key
if (!$client->keyExists('/key/name')) {
    $client->keySet('/key/name', 'value');
}
$client->set('/key/name', 'value', 10); // Set TTL
print $client->keyGet('/key/name');

$client->keyUpdate('/key/name', 'new value');

$client->keyRemove('/key/name');

// Working with dirs
if (!$client->dirExists('/dir/path')) {
    $client->dirCreate('/dir/path');
}
$client->dirUpdate('/dir/path', 10); // Set TTL
$client->dirRemove('/dir/path');

// Get dir info
$client->dirInfo('/dir/path');

// List subdirectories
$client->dirList('/dir/path');

SSL

Client can be configured not to verify SSL peer:, (*7)

$client = (new Client('https://127.0.0.1:4001'))->verifySslPeer(false);

as well as to use a custom CA file:, (*8)

$client = (new Client('https://127.0.0.1:4001'))->verifySslPeer(true, '/path/to/ca/file');

The Versions

21/03 2018

dev-master

9999999-dev https://github.com/DatingVIP/etcd-php

Etcd client library for PHP

  Sources   Download

MIT

The Requires

 

The Development Requires

by PaweƂ MirosƂawski

api php configuration etcd distributed