Skip to content

Commit

Permalink
更新 README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Yurunsoft committed Aug 19, 2022
1 parent 522c322 commit f6488b6
Showing 1 changed file with 22 additions and 8 deletions.
30 changes: 22 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,9 @@

* [x] 配置中心

## Composer
## 安装

本项目可以使用composer安装,遵循psr-4自动加载规则,在你的 `composer.json` 中加入下面的内容:

```json

```

然后执行 `composer update` 安装。
`composer require imiphp/imi-etcd:~2.1.0`

## 使用说明

Expand Down Expand Up @@ -66,6 +60,26 @@
]
```

### 获取配置

```php
\Imi\Config::get('etcd'); // 对应 imi-etcd-key1
```

### 写入配置

```php
/** @var \Imi\ConfigCenter\ConfigCenter $configCenter */
$configCenter = App::getBean('ConfigCenter');
$name = 'imi-etcd-key1';
$value = json_encode(['imi' => 'niubi']);
// prev_kv set value and return previous value
$options = [
'prev_kv' => true,
];
$configCenter->getDriver('etcd')->push($name, $value, $options);
```

## 免费技术支持

QQ群:17916227 [![点击加群](https://pub.idqqimg.com/wpa/images/group.png "点击加群")](https://jq.qq.com/?_wv=1027&k=5wXf4Zq),如有问题会有人解答和修复。
Expand Down

0 comments on commit f6488b6

Please sign in to comment.