定制 doobert/aws-secrets-manager 二次开发

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

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

doobert/aws-secrets-manager

Composer 安装命令:

composer require doobert/aws-secrets-manager

包简介

Laravel package for AWS Secrets Manager integration.

README 文档

README

Latest Version on Packagist Total Downloads MIT License

Seamless integration with AWS Secrets Manager for Laravel. Caching, atomic locking, flexible config mapping, and easy setup.

🚀 Installation

Install via Composer:

composer require doobert/aws-secrets-manager

If not auto-discovered, add the service provider to config/app.php:

'providers' => [
    // ...
    Doobert\AWSSecretsManager\AWSSecretsManagerServiceProvider::class,
],

Publish the configuration file:

php artisan vendor:publish --provider="Doobert\\AWSSecretsManager\\AWSSecretsManagerServiceProvider" --tag=config

⚙️ Configuration

Edit config/aws-secrets-manager.php or set these in your .env:

Key Description Default
enabled Enable/disable the package true
check_latency Log cache/AWS latency false
region AWS region for Secrets Manager us-west-2
cache_ttl Cache lifetime (seconds) 3600
cache_store Laravel cache store to use (e.g., redis) redis
name AWS secret name (empty)
log_channel Log channel for package logs awssecrets
load_in_console Load secrets when running artisan/console false
keys_raw Map secret keys to config (see below) false

Example .env:

AWS_SECRETS_ENABLED=true
AWS_SECRETS_REGION=us-west-2
AWS_SECRETS_CACHE_TTL=3600
AWS_SECRETS_CACHE_STORE=redis
AWS_SECRETS_NAME=your-secret-name
AWS_SECRETS_LOG_CHANNEL=awssecrets
AWS_SECRETS_LOAD_IN_CONSOLE=false
AWS_SECRETS_KEYS_RAW="DB_PASSWORD:database.connections.mysql.password,API_KEY:services.api.key"

🛠 Usage

Inject or resolve the service:

use Doobert\AWSSecretsManager\AWSSecretsManagerService;

$service = app(AWSSecretsManagerService::class);
$secret = $service->getSecret('your-secret-name');

Mapping Secrets to Config

Mapping Secrets to Config

Set AWS_SECRETS_KEYS_RAW or aws-secrets-manager.keys_raw to map secret keys to Laravel config values:

AWS_SECRETS_KEYS_RAW="DB_PASSWORD:database.connections.mysql.password,API_KEY:services.api.key"

Format: SECRET_KEY:config.path, comma-separated for multiple pairs. This will automatically set config values at runtime. Load in Console

Set AWS_SECRETS_LOAD_IN_CONSOLE=true to load secrets when running artisan/console commands (disabled by default for performance).

📋 Logging

All logs are sent to the channel defined in log_channel (default: awssecrets). If not set, logs go to the default Laravel log channel.

Refreshing the secrets in Cache

🛡 Artisan Command: Refresh Secrets

You can manually refresh and cache your AWS secret after rotation using the included artisan command:

php artisan doobertaws:secret-refresh

This will force a fresh fetch from AWS Secrets Manager and update the cache. Useful after rotating secrets in AWS.

Options:

  • --all (future use): Refresh all configured secrets.

Example output:

Refreshing secret: your-secret-name
Secret refreshed and cached in Redis successfully.
    Keys available: DB_PASSWORD, API_KEY

If the secret cannot be fetched, you’ll see an error message with troubleshooting tips.

✅ Testing

From the package directory:

composer install
./vendor/bin/phpunit --configuration phpunit.xml

📦 Requirements

  • Laravel 8.0+
  • PHP 8.0+
  • AWS SDK for PHP

📄 License

MIT

doobert/aws-secrets-manager 适用场景与选型建议

doobert/aws-secrets-manager 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 34 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 04 月 22 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 doobert/aws-secrets-manager 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 doobert/aws-secrets-manager 我们能提供哪些服务?
定制开发 / 二次开发

基于 doobert/aws-secrets-manager 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-04-22