承接 rstgroup/php-consul-kv-array-getter 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

rstgroup/php-consul-kv-array-getter

Composer 安装命令:

composer require rstgroup/php-consul-kv-array-getter

包简介

This library allows you to receive the consul's KV Store's keys as a structured array.

README 文档

README

Build Status

What does this library do?

The library allows you to retrieve whole tree of properties from Consul's KV store. Retrieved data is grouped into nested arrays.

How to install it?

Require the package by Composer:

composer require rstgroup/php-consul-kv-array-getter

How to use the library?

All you need is instance of SensioLabs\Consul\Services\KVInterface and pass it to the RstGroup\PhpConsulKVArrayGetter\Consul\ConsulArrayGetter constructor:

use SensioLabs\Consul\ServiceFactory;
use SensioLabs\Consul\Services\KVInterface;
use RstGroup\PhpConsulKVArrayGetter\Consul\ConsulArrayGetter;

// your consul options:
$consulParams = [
    'base_uri' => 'http://consul-domain:8500'
];

// prepare service that talks to Consul KV
$consulServicesFactory = new ServiceFactory($consulParams);
$kvService = $consulServicesFactory->get(KVInterface::class);

// create getter instance
$consulArrayGetter = new ConsulArrayGetter(
    $kvService
);

// get the keys as structure
$result = $consulArrayGetter->getByPrefix('prefix');

How keys are mapped to return structure?

Let's assume we have list of keys present in KV Store:

application/db/host      => 'some host'
application/cache/prefix => 'abcd.prefix'
application/name         => 'app'

If we fetch config with prefix 'application' we will receive:

$consulArrayGetter->getByPrefix('application') == [
    'application' => [
        'db' => [ 'host' => 'some host' ],
        'cache' => [ 'prefix' => 'abcd.prefix' ],
        'name' => 'app'
    ]
]

If you add slash at the end, the result array will be created relative to application key:

$consulArrayGetter->getByPrefix('application/') == [
    'db' => [ 'host' => 'some host' ],
    'cache' => [ 'prefix' => 'abcd.prefix' ],
    'name' => 'app'
]

Adding another key part after slash will return only those keys that match given prefix:

$consulArrayGetter->getByPrefix('application/db') == [
    'db' => [ 'host' => 'some host' ]
]

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-07-26

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固