定制 paradisesecurity/secrets-manager 二次开发

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

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

paradisesecurity/secrets-manager

Composer 安装命令:

composer require paradisesecurity/secrets-manager

包简介

Secrets management in PHP applications.

README 文档

README

A modern, flexible secrets management library for PHP applications with a fluent builder API and multiple storage backends.

License PHP Version

Features

  • Fluent Builder API - Intuitive, chainable methods for configuration
  • Multiple Storage Backends - File-based and environment-based key storage
  • Secure Encryption - Built on Halite/libsodium for authenticated encryption
  • Vault Management - Organize secrets into isolated vaults
  • Key Rotation - Generate and manage cryptographic keys with ease
  • File & Message Encryption - Encrypt data of any size
  • Zero Configuration - Sensible defaults with full customization

Installation

composer require paradisesecurity/secrets-manager

Quick Start

Basic Usage

use ParadiseSecurity\Component\SecretsManager\Builder\SecretsManagerBuilder;
use ParadiseSecurity\Component\SecretsManager\Key\Key;
use ParagonIE\HiddenString\HiddenString;

// Create authentication key
$authKey = new Key(
    new HiddenString('your-secure-auth-key'),
    'symmetric_authentication_key',
    'halite',
    '5.0.0'
);

// Build the secrets manager
$secretsManager = SecretsManagerBuilder::create()
    ->withAuthKey($authKey)
    ->withPaths('/path/to/project')
    ->withDefaultVault('production')
    ->configureStorage(fn($builder) => 
        $builder
            ->useMasterKeyStorage('env')
            ->withEnvFile('.env')
    )
    ->build();

// Create a vault
$secretsManager->newVault('production');

// Store secrets
$secretsManager->set('database_password', 'super_secret_password');
$secretsManager->set('api_key', 'sk-1234567890abcdef');

// Retrieve secrets
$dbPassword = $secretsManager->get('database_password');
$apiKey = $secretsManager->get('api_key');

Advanced Configuration

$secretsManager = SecretsManagerBuilder::create()
    ->withAuthKey($authKey)
    ->withKeyringName('production-keyring')
    ->withDefaultVault('app-secrets')
    ->withPaths('/var/www/project', '/var/www/project/config/secrets')
    ->configureEncryption(fn($builder) => 
        $builder->useAdapter('halite')
    )
    ->configureStorage(fn($builder) => 
        $builder
            ->useMasterKeyStorage('env')
            ->withEnvFile('.env.production')
    )
    ->configureVault(fn($builder) => 
        $builder->withCache(true, 'secrets-cache')
    )
    ->build();

Architecture

The Secrets Manager is built around a modular architecture with independent builders:

  • EncryptionBuilder - Configure encryption adapters and key generation
  • StorageBuilder - Manage filesystem paths and key storage mechanisms
  • VaultBuilder - Configure vault adapters with optional caching
  • KeyManagerBuilder - Coordinate key generation and management
  • SecretsManagerBuilder - Orchestrate all components into a unified API

Each builder can be used independently or composed together for full functionality.

Storage Options

File-Based Storage

Keys are stored as encrypted files in the filesystem:

$builder->configureStorage(fn($b) => 
    $b->useMasterKeyStorage('file')
);

Environment-Based Storage

Keys are stored in .env files for easy deployment:

$builder->configureStorage(fn($b) => 
    $b->useMasterKeyStorage('env')
      ->withEnvFile('.env.secrets')
);

Documentation

Comprehensive documentation is available in the docs folder:

Requirements

Development Status

⚠️ This library is currently in active development. APIs may change before the first stable release. Not recommended for production use yet.

Testing

composer install
vendor/bin/phpunit

Security

If you discover any security vulnerabilities, please email security@paradisesecurity.work instead of using the issue tracker.

License

This component is open-sourced software licensed under the MIT license.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Credits

Paradise Security - Building secure, decoupled PHP components with the highest quality code.

Paradise Security

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

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

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

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

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-02-01