Skip to content
PHP Library for reading Docker Secrets
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
tests
.gitignore
LICENSE
README.md
composer.json
composer.lock
phpunit.xml

README.md

Secret Keeper

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";
You can’t perform that action at this time.