PHPackages                             shiwang-biz/cpanel-laravel-sdk - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. shiwang-biz/cpanel-laravel-sdk

ActiveLibrary

shiwang-biz/cpanel-laravel-sdk
==============================

Laravel SDK for WHM and cPanel APIs, authenticated via WHM root credentials (WHMCS-style account management).

v1.3.0(today)05↑2900%MITPHPPHP ^8.1

Since Jul 27Pushed todayCompare

[ Source](https://github.com/shiwang-biz/cpanel-laravel-sdk)[ Packagist](https://packagist.org/packages/shiwang-biz/cpanel-laravel-sdk)[ Docs](https://github.com/shiwang-biz/cpanel-laravel-sdk)[ RSS](/packages/shiwang-biz-cpanel-laravel-sdk/feed)WikiDiscussions main Synced today

READMEChangelog (4)Dependencies (4)Versions (5)Used By (0)

 [![cPanel Laravel SDK logo](assets/logo.svg)](assets/logo.svg)

cPanel Laravel SDK
==================

[](#cpanel-laravel-sdk)

 [![Latest Version on Packagist](https://camo.githubusercontent.com/ad02cf58bae1fffea092a20f25f0d8d190d35bf96b7671652750c7be1123771e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f73686977616e672d62697a2f6370616e656c2d6c61726176656c2d73646b2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/shiwang-biz/cpanel-laravel-sdk) [![Latest Release](https://camo.githubusercontent.com/5866c0d70a48543356dcc0541d59a51f0c63c8e656689bc38daea339dc170bbe/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f73686977616e672d62697a2f6370616e656c2d6c61726176656c2d73646b3f7374796c653d666c61742d737175617265)](https://github.com/shiwang-biz/cpanel-laravel-sdk/releases) [![Total Downloads](https://camo.githubusercontent.com/37b433bd9a62fb88ea4d9e4cf605ed24778ab854bca5ae8e6c3acb2400c0199b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f73686977616e672d62697a2f6370616e656c2d6c61726176656c2d73646b2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/shiwang-biz/cpanel-laravel-sdk) [![PHP Version](https://camo.githubusercontent.com/aed74273c9abdec9709c17512c5697df9ca5718afc435809ee2de375ecd40b7c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f73686977616e672d62697a2f6370616e656c2d6c61726176656c2d73646b3f7374796c653d666c61742d737175617265)](https://packagist.org/packages/shiwang-biz/cpanel-laravel-sdk) [![Laravel 10-13](https://camo.githubusercontent.com/9cf2924e1107dfce2f1ce4e149cad74ccace74fa7766e7ffc75fdde112fb89fd/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d31302532302537432532303131253230253743253230313225323025374325323031332d4646324432303f7374796c653d666c61742d737175617265266c6f676f3d6c61726176656c)](https://camo.githubusercontent.com/9cf2924e1107dfce2f1ce4e149cad74ccace74fa7766e7ffc75fdde112fb89fd/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d31302532302537432532303131253230253743253230313225323025374325323031332d4646324432303f7374796c653d666c61742d737175617265266c6f676f3d6c61726176656c) [![License](https://camo.githubusercontent.com/8c87faf7658c9ca97a74b993d17669b485ec399a9976ec6b4516d34befd92ab0/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f73686977616e672d62697a2f6370616e656c2d6c61726176656c2d73646b3f7374796c653d666c61742d737175617265)](LICENSE)

A Laravel SDK for the WHM JSON API, authenticated via WHM root/reseller credentials (the same approach WHMCS uses to manage cPanel accounts without storing per-account passwords).

Requirements
------------

[](#requirements)

- PHP ^8.1
- Laravel (`illuminate/support`, `illuminate/http`) ^10.0 | ^11.0 | ^12.0 | ^13.0

Installation
------------

[](#installation)

```
composer require shiwang-biz/cpanel-laravel-sdk
```

The package auto-registers its service provider and `Cpanel` facade via Laravel package discovery.

Publish the config file:

```
php artisan vendor:publish --tag=cpanel-config
```

Configuration
-------------

[](#configuration)

Set the following in your `.env`:

```
CPANEL_WHM_HOST=whm.example.com
CPANEL_WHM_PORT=2087
CPANEL_WHM_USERNAME=root
CPANEL_WHM_PASSWORD=your-whm-password
CPANEL_WHM_VERIFY_SSL=true
CPANEL_WHM_TIMEOUT=30
```

KeyEnv VariableDefaultDescription`host``CPANEL_WHM_HOST`—WHM server hostname`port``CPANEL_WHM_PORT``2087`WHM API port`username``CPANEL_WHM_USERNAME`—WHM root/reseller username`password``CPANEL_WHM_PASSWORD`—WHM root/reseller password`verify_ssl``CPANEL_WHM_VERIFY_SSL``true`Verify the WHM server's SSL certificate`timeout``CPANEL_WHM_TIMEOUT``30`HTTP request timeout in secondsUsage
-----

[](#usage)

Use the `Cpanel` facade, or inject `Shiwang\CpanelLaravelSdk\CpanelManager`.

```
use Shiwang\CpanelLaravelSdk\Facades\Cpanel;

// Create a cPanel account
Cpanel::accounts()->create([
    'username' => 'newuser',
    'domain' => 'example.com',
    'password' => 'S3cur3Pass!',
    'plan' => 'default',
]);

// Suspend / unsuspend
Cpanel::accounts()->suspend('newuser', 'Non-payment');
Cpanel::accounts()->unsuspend('newuser');

// Terminate an account
Cpanel::accounts()->terminate('newuser', keepDns: false);

// List accounts (optionally filtered)
Cpanel::accounts()->list(['search' => 'example.com', 'searchtype' => 'domain']);

// Account summary
Cpanel::accounts()->summary('newuser');

// Change hosting package / password / quota
Cpanel::accounts()->changePackage('newuser', 'premium');
Cpanel::accounts()->changePassword('newuser', 'N3wPass!');
Cpanel::accounts()->editQuota('newuser', 5000); // MB, 0 = unlimited
```

```
// Create a hosting package
Cpanel::packages()->create([
    'name' => 'gold',
    'quota' => 5000,
    'bwlimit' => 10000,
]);

// Update / delete a package
Cpanel::packages()->update('gold', ['quota' => 10000]);
Cpanel::packages()->delete('gold');

// List packages
Cpanel::packages()->list();
```

```
// Create a DNS zone
Cpanel::dns()->create('example.com', '192.0.2.10');

// Dump / reset / delete a zone
Cpanel::dns()->dump('example.com');
Cpanel::dns()->reset('example.com');
Cpanel::dns()->delete('example.com');

// Edit zone records (raw WHM editzone params, e.g. add/edit/remove records)
Cpanel::dns()->editZone('example.com', [
    'add' => [
        ['record' => 'www', 'type' => 'A', 'ttl' => 14400, 'data' => '192.0.2.10'],
    ],
]);
```

```
// Install an SSL certificate
Cpanel::ssl()->install('example.com', $certPem, $keyPem, $caBundlePem);

// Fetch installed certificate info
Cpanel::ssl()->info('example.com');

// Trigger an AutoSSL check/renewal for a cPanel user
Cpanel::ssl()->runAutoSsl('newuser');
```

```
// Addon domains, subdomains, and parked domains have no direct WHM API 1
// equivalent — WHM proxies these through the target cPanel account's classic
// API 2 modules, so every call needs that account's cPanel username.
Cpanel::domains()->addAddonDomain('newuser', 'addon.com', 'addon', 'public_html/addon');
Cpanel::domains()->deleteAddonDomain('newuser', 'addon.com', 'addon');

Cpanel::domains()->addSubdomain('newuser', 'blog', 'example.com', 'public_html/blog');
Cpanel::domains()->deleteSubdomain('newuser', 'blog.example.com');
Cpanel::domains()->listSubdomains('newuser');

Cpanel::domains()->parkDomain('newuser', 'parked.com', 'example.com');
Cpanel::domains()->unparkDomain('newuser', 'parked.com', 'example.com');
Cpanel::domains()->listParkedDomains('newuser');
```

```
// Email accounts are also account-scoped and proxied the same way as DomainManager.
Cpanel::email()->create('newuser', 'example.com', 'info', 'S3cur3Pass!', 500); // quota in MB, 0 = unlimited
Cpanel::email()->delete('newuser', 'example.com', 'info');
Cpanel::email()->changePassword('newuser', 'example.com', 'info', 'N3wPass!');
Cpanel::email()->editQuota('newuser', 'example.com', 'info', 1000);
Cpanel::email()->list('newuser', 'example.com'); // domain filter optional
```

### Calling raw WHM API functions

[](#calling-raw-whm-api-functions)

Any WHM API 1 function not yet wrapped by this SDK can be called directly through the underlying client:

```
Cpanel::whm()->request('showhostname', [], 'GET');
```

Error Handling
--------------

[](#error-handling)

Failed HTTP requests and unsuccessful WHM API results (`metadata.result !== 1` or legacy `result[0].status !== 1`) both throw `Shiwang\CpanelLaravelSdk\Exceptions\WhmRequestException`, which exposes the decoded response and HTTP status:

```
use Shiwang\CpanelLaravelSdk\Exceptions\WhmRequestException;

try {
    Cpanel::accounts()->suspend('ghost');
} catch (WhmRequestException $e) {
    $e->getMessage();  // "WHM API call [suspendacct] failed: No such user"
    $e->response();    // full decoded WHM response
    $e->httpStatus();  // HTTP status code
}
```

Modules
-------

[](#modules)

ModuleAccessDescription`AccountManager``Cpanel::accounts()`Create, suspend, unsuspend, terminate, list, and manage cPanel accounts`PackageManager``Cpanel::packages()`Create, update, delete, and list hosting packages/plans`DnsManager``Cpanel::dns()`Create, delete, dump, reset DNS zones, and edit zone records`SslManager``Cpanel::ssl()`Install SSL certificates, fetch certificate info, and trigger AutoSSL runs`DomainManager``Cpanel::domains()`Add/remove addon domains, subdomains, and parked domains on an account`EmailManager``Cpanel::email()`Create, delete, list, and manage email accounts (mailboxes) on an accountMore modules will be added over time. `Cpanel::whm()` is always available as an escape hatch for any WHM API function not yet wrapped.

Testing
-------

[](#testing)

```
composer install
vendor/bin/phpunit
```

License
-------

[](#license)

MIT

###  Health Score

40

—

FairBetter than 86% of packages

Maintenance100

Actively maintained with recent releases

Popularity5

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

4

Last Release

0d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/309811299?v=4)[shiwang-biz](/maintainers/shiwang-biz)[@shiwang-biz](https://github.com/shiwang-biz)

---

Tags

cpanelhostinglaravellaravel-packagephpsdkwhmwhm-apilaravelsdkhostingcpanelwhm

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/shiwang-biz-cpanel-laravel-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/shiwang-biz-cpanel-laravel-sdk/health.svg)](https://phpackages.com/packages/shiwang-biz-cpanel-laravel-sdk)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3345.3M348](/packages/psalm-plugin-laravel)[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

77922.3M186](/packages/laravel-mcp)[api-platform/laravel

API Platform support for Laravel

58174.6k17](/packages/api-platform-laravel)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
