定制 pflorek/aws-paramstore 二次开发

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

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

pflorek/aws-paramstore

最新稳定版本:v3.0.0

Composer 安装命令:

composer require pflorek/aws-paramstore

包简介

This library reads parameters from AWS Parameter Store. It supports a path prefix, an optional shared context and multiple profiles. Returns an multi dimensional array of string|int|float|bool. Integrates directly with zendframework/zend-config-aggregator.

README 文档

README

Build Status Coverage Status Scrutinizer Code Quality Latest Stable Version Total Downloads Latest Unstable Version License Monthly Downloads Daily Downloads composer.lock

This library reads parameters from AWS Parameter Store. It supports a path prefix, an optional shared context and multiple profiles. Returns an multi dimensional array of string|int|float|bool. Integrates directly with zendframework/zend-config-aggregator.

Usage

use Aws\Ssm\SsmClient;
use PFlorek\AwsParameterStore\ConfigProvider;

// Provide bootstrap options
$options = [
    'prefix' => '/path/with/prefix', // required
    'name' => 'application-name', // required
    'profileSeparator' => '_', // default => '_'
    'sharedContext' => 'shared-context', // default => ''
];

// Configure AWS Systems Manager Client
$client = new SsmClient([
    'version' => 'latest',
    'region' => 'eu-central-1',
]);
// Or just pass AWS Client options
$client = [
    'version' => 'latest',
    'region' => 'eu-central-1',
];

// Get provided config with active profiles
$environments = ['test'];

// Create AWS Parameter Store Config Provider
$provider = new ConfigProvider($client, $options, $environments);
$config = $provider();

// e.g. returns
//
//array(1) {
//  ["service"]=>
//  array(3) {
//    ["host"]=>
//    string(5) "mysql"
//    ["port"]=>
//    int(3306)
//    ["enabled"]=>
//    bool(true)
//  }
//}

Configuration

parameter required default description
prefix yes none The path prefix of the parameters
name yes none The application name
profileSeparator no '_' The separator between application name and profile
sharedContext no '' The shared context for application with parameters under the same path prefix

Example

Given options:

  • prefix := /path/with/prefix
  • name := app-name
  • profileSeparator := _
  • sharedContext = shared
  • profiles = ['common', 'test']

Will search for parameters with path beginning with:

  1. /path/with/prefix/shared
  2. /path/with/prefix/app-name
  3. /path/with/prefix/app-name_common
  4. /path/with/prefix/app-name_test

Installation

Use Composer to install the package:

composer require pflorek/aws-paramstore

Authors

Contribute

Contributions are always welcome!

License

All contents of this package are licensed under the MIT license.

统计信息

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

GitHub 信息

  • Stars: 5
  • Watchers: 3
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-07-16