定制 s1lver/yii2-etcd 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

s1lver/yii2-etcd

最新稳定版本:1.1.0

Composer 安装命令:

composer require s1lver/yii2-etcd

包简介

Yii2 etcd component

README 文档

README

Latest Stable Version Total Downloads Reliability Rating Security Rating Maintainability Rating Coverage

Interaction component with etcd (A distributed, reliable key-value store for the most critical data of a distributed system) for Yii2 Framework.

https://etcd.io

Required

  • PHP: >= 8.2
  • grpc, protobuf - for RPC

Install

composer require s1lver/yii2-etcd "^1.0.0"

or add

"s1lver/yii2-etcd": "^1.0.0"

to the require section of your composer.json file.

Supported etcd API version

  • v3

Supported etcd methods

Main

  • version

KV

  • range
  • put

Auth

  • authenticate

How to use

Configure

$config = [
    'components' => [
        'etcd' => [
            'class' => \S1lver\Etcd\Etcd::class,
            'host' => 'etcd:2379',
            'user' => 'username',
            'password' => 'password',
        ],
    ],
];

Get key value

Yii::$app->etcd->getKey('hello')->firstKeyValue;

// Hello

Get etcd version

Yii::$app->etcd->version;

// {"etcdserver":"3.5.8","etcdcluster":"3.5.0"}

Switch between supported protocol

etcd v3 uses gRPC for its messaging protocol. For languages with no gRPC support, etcd provides a JSON gRPC gateway. This gateway serves a RESTful proxy that translates HTTP/JSON requests into gRPC messages.

$config = [
    'components' => [
        'etcd' => [
            'class' => \S1lver\Etcd\Etcd::class,
            ...
            'protocol' => '\S1lver\Etcd\EtcdProtocol::GRPC', // Default value \S1lver\Etcd\EtcdProtocol::HTTP
        ],
    ],
];

统计信息

  • 总下载量: 38
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2023-04-13