File: Example.php

Recommend this page to a friend!
  Classes of Juraj Puchký  >  PHP License Key Generator API  >  Example.php  >  Download  
File: Example.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP License Key Generator API
Generate and validate software license keys
Author: By
Last change:
Date: 2 years ago
Size: 775 bytes
 

Contents

Class file image Download
<?php

namespace Devtech\License;

include_once
'Generator.php';
include_once
'License.php';
include_once
'Validator.php';

/**
 * Description of Test
 *
 * @author jpuchky
 */

/*
 * Generate License KEY
 */

$generator = new Generator();
$license = new License("Juraj Puchký", "10.5.2018", "License Test", "1239", "test.devtech.cz");
$licenseKey = $generator->generate($license);
file_put_contents("license.txt", $licenseKey);

/*
 * Validation of License KEY
 */

$licenseKey = file_get_contents("license.txt");
$license = new License("Juraj Puchký", "10.5.2018", "License Test", "1239", $_SERVER['SERVER_NAME']);
$validator = new Validator();
if(
$validator->validate($license, $licenseKey)) {
    echo
"License is VALID\n";
} else {
    echo
"License is not VALID\n";
}


For more information send a message to info at phpclasses dot org.