dvsa/laminas-config-cloud-parameters 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

dvsa/laminas-config-cloud-parameters

最新稳定版本:v2.1.0

Composer 安装命令:

composer require dvsa/laminas-config-cloud-parameters

包简介

README 文档

README

This Composer library facilitates the use of Laminas config placeholders, enabling the substitution of values with those supplied by cloud services dedicated to variable storage using Symfony ParameterBag.

How to use

In a Laminas MVC application

  1. Configure the Cloud providers in your configuration:

    <?php
    
    use Dvsa\LaminasConfigCloudParameters\Provider\SecretsManager;
    use Dvsa\LaminasConfigCloudParameters\Cast\Boolean;
    use Dvsa\LaminasConfigCloudParameters\Cast\Integer;
    
    return [
        'config_parameters' => [
            'providers' => [
                SecretsManager::class => [
                    'example-secret',
                    // ...
                ],
                
                // ...
            ],
    
            'casts' => [
                // Uses `symfony/property-access` to access the property. See https://symfony.com/doc/current/components/property_access.html#reading-from-arrays.
                '[foo]' => Boolean::class,
                '[bar][nested]' => Integer::class,
    
                // ...
            ],
        ],
        // ...
    ];
  2. Register the module with the Laminas ModuleManager:

    <?php
    // module.config.php
    
    return [
        'Dvsa\LaminasConfigCloudParameters',
        // ...
    ];
  3. Placeholders can be then added to the Laminas config:

    return [
        'foo' => '%bar%',
        'bar' => [
            'nested' => '%baz%',
        ],
    ];

Available cloud parameter providers

AWS

Secrets Manager

Only secrets that are stored in key/value pairs are supported.

Example configuration:

<?php

return [
    'config_parameters' => [
        'providers' => [
            SecretsManager::class => [
                'global-secrets',
                sprintf('environment-%s-secrets', $environment),
            ],
            
            // ...
        ],
    ],
];

Parameter Store

Parameters will be loaded recursively by path. The key will be parameter name without the path provided as the key.

Example configuration:

<?php

use Dvsa\LaminasConfigCloudParameters\Provider\ParameterStore;

return [
    'config_parameters' => [
        'providers' => [
            ParameterStore::class => [
                '/global',
                sprintf('/env-%s', $environment),
            ],
            
            // ...
        ],
    ],
];

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 6
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-10-11