1. Go to this page and download the library: Download kanti/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/ */
kanti / secrets example snippets
use Kanti\Secrets\Secrets;
# prerequisite: you need to have a .env file with a KSK_KEY set and It must be loaded in your code
$databasePassword = Secrets::convert('topSecretPassword');
# after first run of this code the code will have change to:
$databasePassword = Secrets::decrypt('7boUYdo8crSe1DsMDZbqG67vcvLxIOhEys1-9Rz-KUfzwX2k5ei5DhC2Wjt1qUzHK2N_pwqsrVO2VSEa');
use Kanti\Secrets\Secrets;
# you can define the location of the ksk-cache.json file like this:
Secrets::setCacheFile('/path/to/ksk-cache.json');
made with ❤️ by Kanti (Matthias Vogel)
bash
# this will generate a new secret and store it in the .env file (if not already present)
./vendor/bin/ksk
# Outputs something like this:
Key already set in /app/.env file
KSK_KEY=ksk-yI1YRuVxsp1jJH7KcU3t2tignYmI2O_PLKqy2flBHzs1XBXudSLwf-lhryOV-qA4Rv0YchDb2jk
╔════════════════════ ═══ ══ ═ ═
║ Found usage:
║ File: /app/sync.php:25
║ value: "t34vctngh3840vngtc803m5b8t0gm2b4m29x4,nr94n,"
║ // load dotenv
║
║ dd([
║ 'password2' => Secrets::decrypt('7boUYdo8crSe1DsMDZbqG67vcvLxIOhEys1-9Rz-KUfzwX2k5ei5DhC2Wjt1qUzHK2N_pwqsrVO2VSEa'), <--- "t34vctngh3840vngtc803m5b8t0gm2b4m29x4,nr94n,"
║ 'top' => Secrets::decrypt('JSeg-Q6xMKJ52UUsLNQY766zNqThMeVRx4pmp03jIgD3wzbnoer-CA'),
║ 'password' => Secrets::decrypt('d0Fcuh2UcsMJe-j7ELUGKaq9NfflO_RH'),
║ ]);
╚════════════════════ ═══ ══ ═ ═
╔════════════════════ ═══ ══ ═ ═
║ Found usage:
║ File: /app/sync.php:26
║ value: "top secret fake password"
║
║ dd([
║ 'password2' => Secrets::decrypt('7boUYdo8crSe1DsMDZbqG67vcvLxIOhEys1-9Rz-KUfzwX2k5ei5DhC2Wjt1qUzHK2N_pwqsrVO2VSEa'),
║ 'top' => Secrets::decrypt('JSeg-Q6xMKJ52UUsLNQY766zNqThMeVRx4pmp03jIgD3wzbnoer-CA'), <--- "top secret fake password"
║ 'password' => Secrets::decrypt('d0Fcuh2UcsMJe-j7ELUGKaq9NfflO_RH'),
║ ]);
║
╚════════════════════ ═══ ══ ═ ═
╔════════════════════ ═══ ══ ═ ═
║ Found usage:
║ File: /app/sync.php:27
║ value: "password"
║ dd([
║ 'password2' => Secrets::decrypt('7boUYdo8crSe1DsMDZbqG67vcvLxIOhEys1-9Rz-KUfzwX2k5ei5DhC2Wjt1qUzHK2N_pwqsrVO2VSEa'),
║ 'top' => Secrets::decrypt('JSeg-Q6xMKJ52UUsLNQY766zNqThMeVRx4pmp03jIgD3wzbnoer-CA'),
║ 'password' => Secrets::decrypt('d0Fcuh2UcsMJe-j7ELUGKaq9NfflO_RH'), <--- "password"
║ ]);
║
║ new SyncCommand(new Config(), new ConsoleLogger($output));
╚════════════════════ ═══ ══ ═ ═
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.