PHP code example of kelunik / aerys-acme

1. Go to this page and download the library: Download kelunik/aerys-acme 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/ */

    

kelunik / aerys-acme example snippets




use Aerys\Acme\AcmeHost;
use Aerys\Host;

const LETS_ENCRYPT_AGREEMENT = "https://letsencrypt.org/documents/LE-SA-v1.0.1-July-27-2015.pdf";
const LETS_ENCRYPT_STAGING = "https://acme-staging.api.letsencrypt.org/directory";
const LETS_ENCRYPT_BETA = "https://acme-v01.api.letsencrypt.org/directory";

$https = (new Host)
    ->expose("*", 443)
    ->name("example.com");

// Currently we need a redirect, because the spec T)
    ->encrypt(LETS_ENCRYPT_STAGING, ["mailto:[email protected]"]);

// if your domain is already whitelisted for Let's Encrypt's closed beta,
// use the right server to obtain a real certificate
// return (new AcmeHost($https, __DIR__ . "/ssl"))
//    ->acceptAgreement(LETS_ENCRYPT_AGREEMENT)
//    ->encrypt(LETS_ENCRYPT_BETA, ["mailto:[email protected]"]);