Yii2 extension to access Etcd service.
Etcd is a key-value store for distributed systems from CoreOS.
Requirements ¶
- Yii2
 - PHP7
 - Etcd service running
 
Usage ¶
See the README.md on Github for details.
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"
If you have any questions, please ask in the forum instead.
Signup or Login in order to comment.