constup/aws-secrets-bundle
Composer 安装命令:
composer require constup/aws-secrets-bundle
包简介
Use AWS Secrets as service container parameters in Symfony.
关键字:
README 文档
README
Use AWS Secrets as service container parameters in Symfony.
Important
This bundle has branches for Symfony 5 and 6 and is not activelly maintained. Symfony 8 bundle is available as a separate library: https://github.com/constup-foss/symfony8-aws-secrets-bundle . Future versions of the bundle will be developed and maintained using the new development model implemeneted for Symfony 8.
Thank you for well over 200.000 Packagist downloads!
History and honorable mentions
This bundle is loosely based on and inspired by incompass/aws-secrets-bundle (https://github.com/casechek/aws-secrets-bundle).
The Incompass bundle is compatible with Symfony 3 and 4, and it looks like it's not updated/maintained anymore. This
package is built to be compatible with Symfony 5 and will, over time, get improvements.
If you are still using Symfony 3 or 4, please use the Incompass bundle instead of this one.
Prerequisites
Install AWS SDK
Since the official recommendation from Symfony is: A bundle must not embed third-party PHP libraries. It should rely on the standard Symfony autoloading instead., the aws/aws-sdk-php Composer package is included in this
bundle only as a dev dependency (for testing purposes).
You need to install AWS SDK for PHP in your project yourself:
composer require aws/aws-sdk-php
AWS credentials
In order to connect to any AWS service (for example: AWS Secrets Manager), your application must be authenticated on that AWS service. Since there are several scenarios for this, depending on your environment setup, configuring environments and using credentials is covered here: AWS credentials and authentication
Installation
There are two main versions of AWS Secrets bundle: 1.x and 2.x.
Install version 1.x to use this package with Symfony 5.x (5.3+) and PHP 7.4.
$ composer require constup/aws-secrets-bundle:^1
Install version 2.x to use this package with Symfony 6.x and PHP 8.x.
$ composer require constup/aws-secrets-bundle:^2
Configuration
By default, configuration for this bundle is loaded from config/packages/aws_secrets.yaml file or its
environment-specific alternatives (for example: config/packages/test/aws_secrets.yaml). The following configuration
properties are available:
aws_secrets: client_config: region: # Required if "ignore" is false. version: 'latest' # Defaults to "latest". endpoint: ~ credentials: key: ~ secret: ~ cache: 'array' # Can be one of the following: apcu, array, filesystem. Default is array. delimiter: ',' # Delimiter to separate key from secret name. ignore: false # Pass through AWS (for local dev environments set to "true").
Usage
Set an env var to an AWS Secret Manager Secret name like so:
AWS_SECRET=secret_name
If you want to grab a key in a JSON secret, you can separate the secret name and key:
AWS_SECRET=secret_name,key
Set a parameter to this environment variable with the aws processor:
parameters: my_parameter: '%env(aws:AWS_SECRET)%'
Your secret will now be loaded at runtime!
Development notes
masterbranch only contains documentation.di5branch is compatible with PHP 7.4+ and Symfony Dependency Injection 5.3+. Release tags for this branch are 1.x.xdi6branch is compatible with PHP 8.x and Symfony Dependency Injection 6.0+. Release tags for this branch are 2.x.x
Examples
constup/aws-secrets-bundle 适用场景与选型建议
constup/aws-secrets-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 218.16k 次下载、GitHub Stars 达 11, 最近一次更新时间为 2021 年 08 月 23 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「symfony」 「aws」 「env」 「Secrets Manager」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 constup/aws-secrets-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 constup/aws-secrets-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 constup/aws-secrets-bundle 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
The bundle for easy using json-rpc api on your project
This package includes a script and fail2ban configuration that allows you to use fail2ban when utilizing AWS elastic load balancer (ELB) and an apache webserver.
Elastic Driver for Laravel Scout
simple api library.
An environment variable convenience library extension for vlucas/phpdotenv
Laravel dotenv manager
统计信息
- 总下载量: 218.16k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 11
- 点击次数: 22
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-08-23