icosillion / secret-keeper
Library to populate Docker Secrets into the environment
Installs: 14 418
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: >=7.2
Requires (Dev)
- phpunit/phpunit: ^7.0
This package is not auto-updated.
Last update: 2025-04-27 07:41:16 UTC
README
PHP Library for reading Docker Secrets
Installation
composer require icosillion/secret-keeper
Examples
Load Single Secret
<?php use Icosillion\SecretKeeper\SecretKeeper; $secretKeeper = new SecretKeeper(); echo $secretKeeper->load('testsecret');
Load All Secrets
<?php use Icosillion\SecretKeeper\SecretKeeper; $secretKeeper = new SecretKeeper(); $secrets = $secretKeeper->loadAll(); foreach ($secrets as $key => $value) { echo "$key => $value\n"; }
Load All Secrets into Environment
<?php use Icosillion\SecretKeeper\SecretKeeper; $secretKeeper = new SecretKeeper(); $secretKeeper->populateEnvironment(); echo "testsecret (superglobal): {$_ENV['testsecret']}\n"; echo 'testsecret (getenv): ' . getenv('testsecret') . "\n";