v1.3 STABLE

Developer Documentation

Everything you need to install LicensePress and protect your software.

LicensePress is a self-hosted licensing solution. It allows you to lock your PHP scripts, WordPress plugins, and themes to a specific domain, track usage via "Spy Mode," and remotely ban unauthorized users.

Server Requirements

PHP 7.4 or higher
Recommended: PHP 8.1+
MySQL Database
MariaDB also supported

Required Extensions: PDO, cURL, OpenSSL.

Installation

1. Upload Files

Upload the entire contents of the unzipped folder to your web server (e.g., public_html/ or a subdomain like license.yoursite.com).

2. Run the Installer

Navigate to your-site.com in your browser. The system will detect that it is not installed and automatically redirect you to the Installation Wizard.

Follow the on-screen steps to enter your database credentials and create your admin account.

3. Security Cleanup

Important: Once installed, you must delete install.php from your server. The Admin Panel > Health Check will warn you if you forget.

Creating Products

Before issuing keys, you must define a Product in the Admin Panel.

  1. Log in to Admin > Products.
  2. Click + New Product.
  3. Enter a Name (e.g., "My Super Script") and a Price (for revenue tracking).
  4. Save the Secret Key! You will need this Secret Key to integrate the protection code into your app.

Integration: PHP Application

Protecting a standard PHP script is a 2-step process.

Step 1: Include the SDK

Copy the LicensePress.php file (found in the client_sdk/ folder) into your script's root directory.

Step 2: Add the Check

Place this code at the very top of your application (e.g., in index.php or config.php).

<?php
require_once 'LicensePress.php';

// CONFIGURATION
$server_url = 'https://license.your-site.com';
$product_secret = 'YOUR_PRODUCT_SECRET_KEY'; // Copy from Admin > Products

$app = new LicensePress($server_url, $product_secret);

// RUN CHECK
if (!$app->check_license()) {
    die("Error: Invalid License Key.");
}

// ... Rest of your application code ...
?>

Integration: WordPress Plugin

LicensePress includes a "WordPress Bridge" that adds a Settings Menu to your plugin automatically.

How to use:

  1. Open client_sdk/wordpress-bridge.php.
  2. Copy the code inside.
  3. Paste it into your WordPress Plugin's main PHP file.
  4. Update the LP_SERVER_URL and LP_PRODUCT_SECRET constants at the top.

This will automatically create a Settings > License Key menu in the WP Admin for your users.

Obfuscation Strategy

Why Obfuscate?

Since PHP is open source, a clever user could delete the line check_license(). Obfuscation makes the code unreadable, preventing tampering.

The "Core File" Method

Do not place the license check in a file that is easy to edit (like index.php). Instead:

  1. Create a file named core.php.
  2. Put the check_license() logic inside it.
  3. Crucial: Also put vital application logic (like DB connections) inside this file.
  4. Use a tool like IonCube or an online PHP Obfuscator to encrypt core.php.

If the user deletes core.php to remove the license check, the app breaks because the vital logic is also gone.

Spy Mode & Analytics

The system automatically tracks usage data every time a license is checked.

  • Last IP: The server IP address running the code.
  • Domain Lock: The first domain to use a key "locks" it. Usage on a second domain will be rejected.
  • Versions: The API returns the "Latest Version" number, allowing you to show "Update Available" banners in your app.

Troubleshooting

License Always Invalid?

  • Check the Product Secret Key. It must match exactly.
  • Check the Health Tab in Admin to ensure your server can make cURL requests.

Forgot Admin Password?

If you configured your email in Settings, use the "Forgot Password" link on the login page. Otherwise, you must edit the database directly via phpMyAdmin.