PHP Library for reading Docker Secrets
composer require icosillion/secret-keeper
<?php
use Icosillion\SecretKeeper\SecretKeeper;
$secretKeeper = new SecretKeeper();
echo $secretKeeper->load('testsecret');
<?php
use Icosillion\SecretKeeper\SecretKeeper;
$secretKeeper = new SecretKeeper();
$secrets = $secretKeeper->loadAll();
foreach ($secrets as $key => $value) {
echo "$key => $value\n";
}
<?php
use Icosillion\SecretKeeper\SecretKeeper;
$secretKeeper = new SecretKeeper();
$secretKeeper->populateEnvironment();
echo "testsecret (superglobal): {$_ENV['testsecret']}\n";
echo 'testsecret (getenv): ' . getenv('testsecret') . "\n";