From 62228ff0c6dd8de012d792668dbd5f0af5c7d3e9 Mon Sep 17 00:00:00 2001 From: ouqiang Date: Mon, 19 Jun 2017 15:03:54 +0800 Subject: [PATCH] update composer.json --- README.md | 10 +++++++--- composer.json | 20 ++++++++++++++++---- src/Client.php | 18 +++++++++--------- 3 files changed, 32 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index e3d6b59..6356f55 100644 --- a/README.md +++ b/README.md @@ -14,9 +14,7 @@ Requirements Installation ------------ ```shell -git clone https://github.com/ouqiang/etcd-php -cd etcd-php -composer install +composer require start-point/etcd-php ``` Usage @@ -75,6 +73,12 @@ $client->authDisable(); // get auth token $client->authenticate('user', 'password'); +// set auth token +$client->setToken($token); + +// clear auth token +$client->clearToken(); + // add a new role $client->addRole('root'); diff --git a/composer.json b/composer.json index cd3bc13..f36524e 100644 --- a/composer.json +++ b/composer.json @@ -1,12 +1,24 @@ { + "name": "start-point/etcd-php", + "type": "library", + "description": "PHP client for Etcd v3", + "keywords": ["etcdv3", "etcd", "etcd-client", "etcd-php"], + "homepage": "https://github.com/ouqiang/etcd-php", + "license": "MIT", + "authors": [ + { + "name": "ouqiang", + "email": "qingqianludao@gmail.com", + "homepage": "https://github.com/ouqiang" + } + ], "require": { - "php": ">= 5.5" + "php": ">= 5.5", + "guzzlehttp/guzzle": "~6.0" }, "require-dev": { - "phpunit/phpunit": "4.5.*", - "guzzlehttp/guzzle": "~6.0" + "phpunit/phpunit": "4.5.*" }, - "autoload": { "psr-4": { "Etcd\\": "src/" diff --git a/src/Client.php b/src/Client.php index 7bf5ae5..6653687 100644 --- a/src/Client.php +++ b/src/Client.php @@ -66,7 +66,7 @@ class Client protected $httpClient; /** - * @var bool �Ѻ����, ֻ���������ֶ� + * @var bool 友好输出, 只返回所需字段 */ protected $pretty = false; @@ -116,7 +116,7 @@ public function clearToken() * * @param string $key * @param string $value - * @param array $options ��ѡ���� + * @param array $options 可选参数 * int64 lease * bool prev_kv * bool ignore_value @@ -641,11 +641,11 @@ public function revokeUserRole($user, $role) // endregion auth /** - * ����HTTP���� + * 发送HTTP请求 * * @param string $uri - * @param array $params ������� - * @param array $options ��ѡ���� + * @param array $params 请求参数 + * @param array $options 可选参数 * @return array|BadResponseException */ protected function request($uri, array $params = [], array $options = []) @@ -653,7 +653,7 @@ protected function request($uri, array $params = [], array $options = []) if ($options) { $params = array_merge($params, $options); } - // û�в���, ����һ��Ĭ�ϲ��� + // 没有参数, 设置一个默认参数 if (!$params) { $params['php-etcd-client'] = 1; } @@ -676,7 +676,7 @@ protected function request($uri, array $params = [], array $options = []) } /** - * string����key��base64���� + * string类型key用base64编码 * * @param array $data * @return array @@ -694,11 +694,11 @@ protected function encode(array $data) } /** - * ָ���ֶ�base64���� + * 指定字段base64解码 * * @param array $body * @param string $bodyKey - * @param array $fields ��Ҫ������ֶ� + * @param array $fields 需要解码的字段 * @return array */ protected function decodeBodyForFields(array $body, $bodyKey, array $fields)