-
-
Notifications
You must be signed in to change notification settings - Fork 29
Create a License
The CreateLicense.php
file allows you to securely create a new license in your application by sending a request to the SLM Plus API. This guide explains how to configure and use CreateLicense.php
to generate new licenses.
- Ensure
CoreConfig.php
is configured with your API URL and secret key. - Verify that
LicenseAPI.php
is included in your project, as it contains the core method for creating licenses.
-
Open
CreateLicense.php
. -
Define the license data as an associative array with the necessary fields. Here’s an example of basic fields you may need:
$licenseData = [ 'first_name' => 'John', 'last_name' => 'Doe', 'email' => '[email protected]', 'purchase_id_' => '12345', // Unique ID for tracking the purchase 'max_allowed_domains' => 2, // Maximum number of domains for this license 'max_allowed_devices' => 1, // Maximum number of devices for this license 'date_created' => date('Y-m-d'), // License creation date 'product_ref' => 'YourProduct' // Reference name for the product ];
Adjust these fields as needed to match your product or user data.
-
Instantiate
CreateLicense
. -
Call the
create()
method with the$licenseData
array. Here’s how:require_once 'CreateLicense.php';
$createLicense = new CreateLicense(); $createLicense->create($licenseData);
This sends a request to create the license using the SLM Plus API.
CreateLicense.php
provides a response indicating the success or failure of the license creation. Here’s what to expect:
- Success: If the license is created successfully, you’ll see a message with the generated license key.
- Error: If there’s an issue (e.g., missing fields or invalid data), an error message will be displayed.
Below is a complete example of using CreateLicense.php
to create a new license:
require_once 'CreateLicense.php';
$licenseData = [
'first_name' => 'John',
'last_name' => 'Doe',
'email' => '[email protected]',
'purchase_id_' => '12345',
'max_allowed_domains' => 2,
'max_allowed_devices' => 1,
'date_created' => date('Y-m-d'),
'product_ref' => 'YourProduct'
];
$createLicense = new CreateLicense();
$createLicense->create($licenseData);
Once you’ve configured and tested license creation, you can proceed to other actions:
Updated and maintained by Epikly