1. Go to this page and download the library: Download victorwesterlund/php-age 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/ */
victorwesterlund / php-age example snippets
// Encrypt a file with a generated key
$age = new FileEncryption("hello.txt");
$keypair = $age->keygen("hello.key")->encrypt("hello.txt.age");
// Encrypt a file with a specific public key
$age->public_key("age1mrf8uana2kan6jsrnf04ywxycvl4nnkzzk3et8rdz6fe6vg7upssclnak7")->encrypt("hello.txt.age");
// Decrypt a file with a key file
$age = new FileEncryption("hello.txt.age");
$age->private_key("hello.key")->decrypt("decrypted-hello.txt");
use \Age\FileEncryption;
// Relative or absolute path to a file that should be encrypted
$age = new FileEncryption("hello.txt");
// encrypt() will return the generated keypair as an assoc array
$keypair = $age->keygen()->encrypt("hello.txt.age"); // ["public" => "...", "private" => "..."]