1. Go to this page and download the library: Download evilfreelancer/easyrsa-php 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/ */
evilfreelancer / easyrsa-php example snippets
use EasyRSA\Downloader;
$dnl = new Downloader([
'archive' => './easy-rsa.tar.gz',
'scripts' => './easy-rsa',
]);
$dnl->getEasyRSA();
use Dotenv\Dotenv;
use EasyRSA\Commands;
// Load dotenv?
if (file_exists(__DIR__ . '/../vars.example')) {
Dotenv::createImmutable(__DIR__ . '/../', 'vars.example')->load();
}
$cmd = new Commands([
'scripts' => './easy-rsa',
'certs' => './easy-rsa-certs',
]);
$cmd->initPKI();
$cmd->buildCA(true);
$cmd->genDH();
$cmd->buildServerFull('server', true);
$cmd->buildClientFull('client1', true);
$cmd->buildClientFull('client2', true);