servertheme/api-sdk

ServerTheme API SDK - Enterprise Tiered License + Provider Execution Bridge

Maintainers

Package info

github.com/shamimlaravel/ServerTheme-API-SDK

Homepage

Documentation

pkg:composer/servertheme/api-sdk

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

4.0.0 2026-02-21 01:29 UTC

This package is auto-updated.

Last update: 2026-03-08 10:02:03 UTC


README

Enterprise Tiered License + Provider Execution Bridge

Version: 4.0.0

ServerTheme API SDK is a robust PHP package designed for unlock service platforms, SaaS API gateways, and multi-provider execution engines. It provides a complete solution for commercial script licensing and Dhru Fusion API integration.

Features

  • Tier 1 - License Validation: Secure handshake with ServerTheme license server, 12-hour cache, domain pinning
  • Tier 2 - Provider Execution: Primary + Secondary provider with automatic failover
  • Tier 3 - Order Synchronization: Poll provider for order status, retrieve unlock codes
  • User Panel: API key management, custom endpoints per user
  • Multi-frontend Support: Livewire + Vue.js components included
  • RESTful API: Full API endpoints for external integration

Architecture

Client Application
        ↓
API SDK
        ↓
Tier 1 → License Authority (servertheme.com)
        ↓
Tier 2 → Primary Provider API
        ↓
Tier 2 → Secondary Failover (Optional)
        ↓
Tier 3 → Sync Engine

Requirements

  • PHP 8.2+
  • Laravel 10 / 11 / 12
  • Composer

Installation

composer require servertheme/api-sdk

Publish Configuration

php artisan vendor:publish --tag=servertheme-config

Run Migrations

php artisan migrate

Configuration

Create or update .env file:

# License
ST_LICENSE=ST-XXXX-XXXX

# Primary Provider (Dhru Fusion)
DHRU_URL=https://provider.com/api
DHRU_USER=apiuser
DHRU_KEY=apikey

# Secondary Provider (Failover)
SECONDARY_URL=
SECONDARY_USER=
SECONDARY_KEY=

# Settings
ST_ENABLE_FAILOVER=true
ST_TIMEOUT=25
ST_LICENSE_CACHE_TTL=43200
ST_ALLOW_USER_ENDPOINTS=true
ST_ALLOW_CUSTOM_PROVIDER=true

Usage

Basic Example

use ServerTheme\ApiSdk\Facades\ApiSdk;

$bridge = app(ApiSdk::class);

// Place order
$response = $bridge->placeOrder('123456789012345', 12);

// Check order status
$result = $bridge->syncOrder('REMOTE_ID_123');

// Get available services
$services = $bridge->getServices();

// Get account balance
$balance = $bridge->getBalance();

License Handshake

$result = $bridge->handshake();
// Returns: ['status' => 'SUCCESS', 'message' => 'Handshake successful', ...]

User Context

// Set user context for user-specific operations
$bridge->setUserContext($userId);

// Now operations use user's configured endpoint (if available)
$response = $bridge->placeOrder('123456789012345', 12);

User Panel API

Generate API Key

use ServerTheme\ApiSdk\User\UserPanelManager;

$panel = new UserPanelManager($userId);

// Generate new API key
$apiKey = $panel->generateApiKey('Production');

// Regenerate existing key
$apiKey = $panel->regenerateApiKey();

// Deactivate/Activate
$panel->deactivateApiKey();
$panel->activateApiKey();

Manage Endpoints

// Add custom endpoint
$endpoint = $panel->addEndpoint([
    'api_url' => 'https://custom.provider.com/api',
    'api_username' => 'user',
    'api_key' => 'secret',
    'provider_name' => 'Custom Provider',
]);

// List endpoints
$endpoints = $panel->getEndpoints();

// Set default endpoint
$panel->setDefaultEndpoint($endpointId);

// Delete endpoint
$panel->deleteEndpoint($endpointId);

API Endpoints

Authenticated Routes (require auth:sanctum)

Method Endpoint Description
GET /api/servertheme/balance Get account balance
GET /api/servertheme/services List available services
POST /api/servertheme/order Place new order
GET /api/servertheme/order/{id} Get order status
POST /api/servertheme/apikey/generate Generate API key
POST /api/servertheme/apikey/regenerate Regenerate API key
GET /api/servertheme/endpoints List user endpoints
POST /api/servertheme/endpoints Add endpoint
PUT /api/servertheme/endpoints/{id} Update endpoint
DELETE /api/servertheme/endpoints/{id} Delete endpoint

Public Routes (API Key Auth)

Method Endpoint Description
POST /api/servertheme/order Place order with API key
GET /api/servertheme/order/{id} Check order status

Response Format

All responses follow this structure:

{
    "status": "SUCCESS|ERROR",
    "message": "Operation message",
    "data": {},
    "timestamp": "2024-01-01T00:00:00+00:00"
}

Frontend Integration

Livewire

use ServerTheme\ApiSdk\Http\Livewire\ApiKeyManager;

@livewire(ApiKeyManager::class)

Vue.js (Inertia)

<template>
  <ApiKeyManager :user-id="userId" />
</template>

<script setup>
import ApiKeyManager from '@/vendor/servertheme/ApiKeyManager.vue'
</script>

Security

  • License-first execution model
  • Domain-bound validation
  • 12-hour cache for license
  • Encrypted API key storage
  • API key masking
  • Automatic failover
  • Timeout protection (25s)

Testing

# Run all tests
composer test

# Run unit tests
composer test:unit

# Run with coverage
composer test:coverage

# Run PHPStan
composer phpstan

# Run Pint (code style)
composer pint

License

Commercial - All rights reserved

Support