1. Go to this page and download the library: Download lockerpm/locker-secrets library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
lockerpm / locker-secrets example snippets
use Locker\ClientOptions;
use Locker\Locker;
$locker = new Locker(
accessKeyId: $accessKeyId,
secretAccessKey: $secretAccessKey,
options: new ClientOptions(cliPath: '/opt/locker/bin/locker'),
);
use Locker\Locker;
$locker = Locker::fromEnvironment();
$databasePassword = $locker->getRequired('DATABASE_PASSWORD');
use Locker\ClientOptions;
use Locker\Locker;
$options = new ClientOptions(
cliPath: '/opt/locker/bin/locker',
timeoutSeconds: 15.0,
apiBase: 'https://api.locker.io/locker_secrets',
headers: ['CF-Access-Client-Id' => $clientId],
forceRefresh: false,
cacheMaxAgeSeconds: 120,
);
$locker = new Locker($accessKeyId, $secretAccessKey, $options);
use Locker\Exception\AlreadyExistsException;
use Locker\Exception\ConflictException;
try {
$locker->secrets()->create(
key: 'PAYMENT_API_KEY',
value: 'value',
);
} catch (AlreadyExistsException $error) {
// The secret or environment already exists.
// AlreadyExistsException is also a ConflictException.
}
use Locker\Distribution\CliInstaller;
$path = (new CliInstaller())->installLatest();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.