Example code for a sample Project...of PHP Code Hypdrater
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
ProjectCodeHydrater/protected/cli/makeLicense.php

40 lines
1.1 KiB

<?php
use HydraterLicense\MakeLicense;
define("BaseDir", dirname(__DIR__));
// Using standard ISO 8601 format, and make it expire in 4 years
define('EXPIRES_DATE', (new DateTime('+4 years'))->format(DateTime::ATOM));
$license_maker = new MakeLicense();
define("PWD1", $license_maker->makePassword());
define("PWD2", $license_maker->makePassword());
const Array_For_Files = [
BaseDir. "/src/aes/main.aes" =>
[ "feature" => "testing", "enabled" => true, "expires" => EXPIRES_DATE, "password" => PWD1 ],
BaseDir. "/src/aes/config.aes" =>
[ "feature" => "junk", "enabled" => false, "password" => PWD2 ],
];
const ALLOWED_DOMAINS = ["localhost", "sub.example.org"];
const PrivatePEM = BaseDir."/keydata/private.pem";
const PublicPEM = BaseDir."/keydata/public.pem";
const AESKeysFile = BaseDir."/src/aeskeys.php";
const LicenseFile = BaseDir."/keydata/license.json";
$license_maker->generateLicense(
Array_For_Files,
ALLOWED_DOMAINS,
PrivatePEM,
PublicPEM,
AESKeysFile,
LicenseFile
);
/**
* use stars for unlimited access for domains and expires dates if desired!
*/