- PHP 100%
These LithiumHosting/* packages are standalone Laravel libraries licensed under MIT, not LiBilling-specific components. The "LiBilling is (C) Lithium Holdings..." preamble belongs only on LiBilling/* integration packages. Strip the preamble; keep the per-package MIT attribution line. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> |
||
|---|---|---|
| config | ||
| src | ||
| .gitignore | ||
| CHANGELOG.md | ||
| composer.json | ||
| CONTRIBUTING.md | ||
| LICENSE.md | ||
| README.md | ||
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.".