weesee / yii2-etcd
Yii2 extension to work with ETCD key-value store from CoreOS
Installs: 386
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 2
Forks: 1
Type:yii2-extension
Requires
- php: >=7.0
- activecollab/etcd: ^1.0
- yiisoft/yii2: ~2.0.13
This package is not auto-updated.
Last update: 2024-11-04 18:16:43 UTC
README
Yii2 extension to access Etcd service.
Etcd is a key-value store for distributed systems.
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist weesee/yii2-etcd "*"
or add
"weesee/yii2-etcd": "*"
to the require section of your composer.json
file.
Usage
Once the extension is installed, simply use it in your code by:
use weesee\etcd\Etcd; // setup connection to Etcd // setting root means all key are appended to this path $etcd = new Etcd([ 'etcdUrl' => 'http://127.0.0.1:2379', 'root'=>"/yii2-etcd-test/" ]); // write key value pairs to etcd if ($etcd->exists("name")) $etcd->update("name","value"); // updates "/yii2-etcd-test/name" else $etcd->set("name","value"); // sets "/yii2-etcd-test/name" // remove key $etcd->removeKey("name"); // removes "/yii2-etcd-test/name" // get keys with values in current directory "/yii2-etcd-test" // as ArrayDataProvider. Simple to use for GidViews,... $dataProvider = $etcd->getKeyValueAsDataProvider();
Credits
Thanks for your great job which this Yii2-extension is build on:
Author / Licence
WeeSee weesee@web.de
GNU GENERAL PUBLIC LICENSE, Version 3, 29 June 2007