ApisCP API Wrapper for Laravel
Find a file
2026-07-08 21:09:16 +00:00
config initial commit 2026-07-08 21:09:16 +00:00
src initial commit 2026-07-08 21:09:16 +00:00
.gitignore initial commit 2026-07-08 21:09:16 +00:00
CHANGELOG.md initial commit 2026-07-08 21:09:16 +00:00
composer.json initial commit 2026-07-08 21:09:16 +00:00
CONTRIBUTING.md initial commit 2026-07-08 21:09:16 +00:00
LICENSE.md initial commit 2026-07-08 21:09:16 +00:00
README.md initial commit 2026-07-08 21:09:16 +00:00

Laravel ApisCP API

A Laravel package for interacting with the ApisCP (apnscp) SOAP API. Provides typed shortcut methods for common hosting operations, session hijacking for SSO, IP ban management via Rampart/fail2ban, and retry-capable SOAP client.

Features

  • Account Lifecycle: Create, suspend, activate, delete, and edit hosting accounts
  • Plan Management: List available plans, upgrade/downgrade accounts
  • Usage Stats: Disk and bandwidth usage queries
  • SSO / Session Hijacking: Generate admin sessions for customer impersonation
  • IP Ban Management: Check and unban IPs via Rampart/fail2ban integration
  • Password Changes: Change account admin passwords
  • Retry Logic: Automatic retry (up to 5 attempts) on null SOAP responses
  • SSL Configuration: Configurable SSL verification for self-signed certs

Installation

This package is loaded as a local Composer path repository. No separate installation is needed when developing within the LiBilling monorepo.

For standalone installation:

composer require lithiumhosting/laravel-apiscp-api

Publish the config file:

php artisan vendor:publish --provider="LithiumHosting\Laravel\ApisCpApi\ApisCpApiServiceProvider" --tag="config"

Configuration

Set your preferences in .env:

APISCP_VERIFY_SSL=true

Config Options

Key Env Default Description
verify_ssl APISCP_VERIFY_SSL true Verify SSL certificates (set false for self-signed certs in dev)

API credentials (hostname, port, API key) are configured per-server in the LiBilling admin panel and passed via ServerDTO.

Usage

use LithiumHosting\Laravel\ApisCpApi\ApisCpApi;
use App\DTOs\ServerDTO;

$api = new ApisCpApi();
$api->init($server); // ServerDTO with hostname, port, password (API key)

// Account lifecycle
$api->createAccount('example.com', 'admin', ['siteinfo.plan' => 'basic']);
$api->suspendAccount('example.com', 'Non-payment');
$api->activateAccount('example.com');
$api->deleteAccount('example.com');
$api->editAccount('example.com', ['siteinfo.plan' => 'premium'], ['reset' => true]);

// Password management
$api->changeAccountPassword('example.com', 'admin', 'newpassword');

// Server info
$api->listAccounts();
$api->listPackages($server);

// Usage
$api->getDiskUsage('example.com');
$api->getBandwidthUsage('example.com');

// SSO / Session hijacking
$sessionId = $api->hijackSession('example.com', 'admin');

// IP ban management (Rampart/fail2ban)
$jails = $api->isBanned('1.2.3.4', 'example.com');
$api->unBan('1.2.3.4');

// Connection test
$result = $api->testConnection($server); // Returns uptime on success

Direct SOAP Calls

For operations not covered by shortcuts, call ApisCP SOAP methods directly:

$api->client->admin_list_plans();
$api->client->common_get_web_server_name();

Dependencies

  • ext-soap: PHP SOAP client

License

This package, laravel-apiscp-api is licensed under The MIT License (MIT). Please see License File for more information.

Is it any good?

Yes.

When people first hear about a new product, they frequently ask if it is any good. A Hacker News user remarked:

Note to self: Starting immediately, all raganwald projects will have a "Is it any good?" section in the readme, and the answer shall be "yes.".