PHPackages                             ayowande/cpanel-api - 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. [API Development](/categories/api)
4. /
5. ayowande/cpanel-api

ActiveLibrary[API Development](/categories/api)

ayowande/cpanel-api
===================

A lightweight PHP client for interacting with cPanel's API, providing methods for common tasks like managing domains, emails, and server resources.

v1.0.1(1y ago)05MITPHPPHP ^8.0

Since Aug 24Pushed 1y ago1 watchersCompare

[ Source](https://github.com/ayowandeapp/cpanel-api)[ Packagist](https://packagist.org/packages/ayowande/cpanel-api)[ RSS](/packages/ayowande-cpanel-api/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (1)Versions (3)Used By (0)

cPanel API Client
=================

[](#cpanel-api-client)

A simple and lightweight PHP client for interacting with the cPanel API using cURL. This package allows you to easily manage cPanel accounts, domains, emails, and other server resources through a straightforward API.

Features
--------

[](#features)

- Simple and intuitive API for interacting with cPanel
- Supports GET and POST requests to cPanel's API endpoints
- Easy configuration via constructor parameters
- Handles authentication with cPanel's API tokens

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

[](#installation)

Install the package via Composer:

```
composer require ayowande/cpanel-api
```

Usage
-----

[](#usage)

**Initialization**

First, create an instance of the Cpanel class with your cPanel server details:

```
use ayowande\Cpanel\Cpanel;

$cpanel = new Cpanel(
    'example.com',    // cPanel server hostname
    'username',       // cPanel username
    2083,             // Port (usually 2083 for SSL)
    'your-api-token'  // cPanel API token
);
```

**Sending a GET Request**

To send a GET request to a specific cPanel API endpoint:

```
$response = $cpanel->get('/json-api/listaccts', [
    'api.version' => 1
]);

echo $response;
```

**Sending a POST Request**

To send a POST request with data:

```
$response = $cpanel->post('/json-api/createacct', [
    'api.version' => 1,
    'username' => 'newuser',
    'domain' => 'newdomain.com',
    'plan' => 'default'
]);

echo $response;
```

**check out the test for more examples on various use cases**

- [Test](./tests/CpanelTest.php)

```
vendor/bin/phpunit

```

**Handling Errors**

Both get and post methods throw exceptions if the cURL request fails. You can handle these exceptions like this:

```
try {
    $response = $cpanel->get('/json-api/listaccts', [
        'api.version' => 1
    ]);

    echo $response;
} catch (Exception $e) {
    echo "Error: " . $e->getMessage();
}
```

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

[](#requirements)

- PHP 8.0 or higher
- cURL extension enabled
- cPanel API token

Contributing
------------

[](#contributing)

Contributions are welcome! Please submit a pull request or open an issue to discuss any changes.

###  Health Score

24

—

LowBetter than 31% of packages

Maintenance33

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

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

2

Last Release

677d ago

PHP version history (2 changes)v1.0.0PHP ^7.3

v1.0.1PHP ^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/66342315?v=4)[Ayowande Oluwatosin](/maintainers/ayowandeapp)[@ayowandeapp](https://github.com/ayowandeapp)

---

Top Contributors

[![ayowandeapp](https://avatars.githubusercontent.com/u/66342315?v=4)](https://github.com/ayowandeapp "ayowandeapp (4 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ayowande-cpanel-api/health.svg)

```
[![Health](https://phpackages.com/badges/ayowande-cpanel-api/health.svg)](https://phpackages.com/packages/ayowande-cpanel-api)
```

###  Alternatives

[exsyst/swagger

A php library to manipulate Swagger specifications

35916.4M7](/packages/exsyst-swagger)[hubspot/api-client

Hubspot API client

24016.2M20](/packages/hubspot-api-client)[pocketmine/bedrock-protocol

An implementation of the Minecraft: Bedrock Edition protocol in PHP

172445.0k13](/packages/pocketmine-bedrock-protocol)[botman/driver-telegram

Telegram driver for BotMan

93459.5k6](/packages/botman-driver-telegram)

PHPackages © 2026

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