LiSense

LiSense LAAS Integration

One-line license verification for your applications

PHP Integration

1 Installation

Terminal
curl -O https://lisensetech.com/downloads/lisense.zip

2 Implementation

PHP
<?php
// Single-line integration
require_once __DIR__.'/path/to/lisense/laas_client.php';
if (!defined('LAAS_CLIENT_LOADED')) {
    http_response_code(500);
    echo 'laas_client.php was not loaded correctly.';
    exit;
};
// License verification happens automatically
?>

How It Works

  1. Include the client file in your application
  2. Automatic license verification occurs in the background
  3. Invalid licenses redirect to /license-error.php
  4. Valid licenses continue normal code execution

Other Languages

laas_client.php is a convenience wrapper — the license check itself is one plain HTTPS POST with a JSON body. Any language that can make an HTTP request can integrate directly against the same endpoint PHP uses.

Endpoint POST https://lisensetech.com/api/v1/validate.php
Request body (JSON) license_code, app_id, domain

domain should be the calling app's own hostname — send the same value every time. A license auto-binds to whatever domain first validates it successfully, so an omitted or inconsistent value will make later calls fail domain matching even though the license itself is fine. If your app has an API key configured, send it as an X-API-Key header.

Python

requests
import requests

response = requests.post(
    "https://lisensetech.com/api/v1/validate.php",
    json={
        "license_code": "YOUR_LICENSE_CODE",
        "app_id": 1,
        "domain": "yourapp.com",
    },
    timeout=5,
)
data = response.json()

if not data.get("valid"):
    raise SystemExit(f"License invalid: {data.get('error')}")

Node.js

fetch
const res = await fetch("https://lisensetech.com/api/v1/validate.php", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    license_code: "YOUR_LICENSE_CODE",
    app_id: 1,
    domain: "yourapp.com",
  }),
});
const data = await res.json();

if (!data.valid) {
  throw new Error(`License invalid: ${data.error}`);
}

cURL

Shell
curl -X POST https://lisensetech.com/api/v1/validate.php \
  -H "Content-Type: application/json" \
  -d '{
    "license_code": "YOUR_LICENSE_CODE",
    "app_id": 1,
    "domain": "yourapp.com"
  }'

Response Shape

JSON
{
  "valid": true,
  "license_code": "LAAS-A1B2-C3D4E5F6",
  "app": "Your App",
  "expiry_date": "2026-12-31",
  "days_remaining": 132,
  "flags": {}
}

On failure, valid is false and an error code is included — see Error Handling for the full list. There's no PHP-specific behavior in the response itself; build your own equivalent of laas_client.php's caching/retry/redirect logic in your own language if you want the same resilience.

Error Handling

Custom Error Page

license-error.php
<?php
// license-error.php
session_start();
$error = $_SESSION['license_error'] ?? [
    'code' => 'unknown',
    'message' => 'License verification failed'
];
?>
<!-- Your HTML here -->
<div class="error-message">
    <h1>Error: <?= htmlspecialchars($error['code']) ?></h1>
    <p><?= htmlspecialchars($error['message']) ?></p>
    <?php if (isset($error['renewal_url'])): ?>
    <a href="<?= $error['renewal_url'] ?>">Renew License</a>
    <?php endif; ?>
</div>

Standard Error Codes

Code Description
expired License has expired
invalid_format License code doesn't match the LAAS-XXXX-XXXXXXXX format
not_found_or_domain_mismatch License doesn't exist for this app, or the calling domain doesn't match the domain it's bound to
sandbox_license_wrong_endpoint A sandbox/test license was sent to the real endpoint — use /api/v1/sandbox/validate.php instead
concurrent_limit_exceeded Floating license already at its max concurrent instance limit
missing_instance_id A floating license requires an instance_id in the request
invalid_api_key This app requires an API key (X-API-Key header) and none, or an invalid one, was sent
rate_limit_exceeded / app_rate_limit_exceeded Too many verification attempts — per-IP or per-app limit hit
database_error / system_error Server-side failure — safe to retry
connection_failed Client-side: could not reach the API at all (network issue)
Error codes are passed via session variables and can be styled according to your application's design system.

Configuration

Client Options

laas_client.php
final class LAAS {
    const API_URL = 'https://lisensetech.com/api/v1/validate.php';
    const LICENSE_CODE = 'YOUR_LICENSE_CODE'; // Set your license here
    const APP_ID = 1; // Your application ID
    const CACHE_TTL = 86400; // Cache duration in seconds (24h)
}

These are the constants you edit at the top of the downloaded laas_client.php — you don't need to write this class yourself.

Server Requirements

  • PHP 7.4+
  • PDO MySQL extension
  • SSL/TLS for secure connections
  • Session support enabled
Ensuring these requirements are met will guarantee smooth operation of the licensing system.

API Sandbox

About This Sandbox

Test different license scenarios without affecting your production environment. This sandbox simulates API responses for development and debugging purposes.

API Response
{
  "status": "Select a scenario to test"
}

Quick Start

1

Download

Download lisense.zip, which contains laas_client.php

2

Include

Include it in your application code: require 'lisense/laas_client.php';

3

Configure

Set your license code in the client file

4

Error Page

Create license-error.php at your app root (a working template is included in the zip)