PHPackages                             keensoen/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. keensoen/cpanel-api

ActiveLibrary[API Development](/categories/api)

keensoen/cpanel-api
===================

cPanel API which enables you to connect and carry out several common task in the cpanel

v1.2(5y ago)11.5k↓100%2MITPHPPHP ^7.1

Since Mar 29Pushed 5y ago2 watchersCompare

[ Source](https://github.com/keensoen/CPanel-Api)[ Packagist](https://packagist.org/packages/keensoen/cpanel-api)[ Docs](https://github.com/keensoen/cpanel-api)[ RSS](/packages/keensoen-cpanel-api/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (4)Used By (0)

Laravel CPanel API
==================

[](#laravel-cpanel-api)

[![Latest Version on Packagist](https://camo.githubusercontent.com/ec37b8daf09800dfb5e86afd1c3b4f0633a0296bf0a31e4ea0543f11e89183c6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6b65656e736f656e2f6370616e656c2d6170692e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/keensoen/cpanel-api)[![Build Status](https://camo.githubusercontent.com/c330b2abce21c2f2b9f3b6ae18f10c19b1dad5ede58d32192840454d354d93b3/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6b65656e736f656e2f6370616e656c2d6170692f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/keensoen/cpanel-api)[![Quality Score](https://camo.githubusercontent.com/199e14197b123925dcca2cc84c8d216cd944a30e2f9d2a682a64d146dbd12742/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f6b65656e736f656e2f6370616e656c2d6170692e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/keensoen/cpanel-api)[![Total Downloads](https://camo.githubusercontent.com/69a6f4a467200ffd078edd07ce334177556271172beccb6fc1dd81517f91cee5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6b65656e736f656e2f6370616e656c2d6170692e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/keensoen/cpanel-api)

> Laravel Package for CPanel UAPI

Please consider starring the project to show your ❤️ and support.

> This laravel package allows you to connect and manage you CPanel based hosting using CPanel UAPI.

Some practical usages are:

- Create database, sub domains, emails accounts etc
- Create database users
- Set privileges on database of any user
- List all email account of the specified domain
- Check email account size
- Increase email quota when need arises
- Delete email account when necessary

Learn more about at [CPanel UAPI](https://documentation.cpanel.net/display/DD/Guide+to+cPanel+API+2)

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

[](#installation)

#### Step 1) Install the Package

[](#step-1-install-the-package)

Use following composer command to install the package

```
composer require keensoen/cpanel-api
```

or Add `keensoen/cpanel-api` as a requirement to `composer.json`:

```
{
    ...
    "require": {
        ...
        "keensoen/cpanel-api": "^1.0"
    },
}

```

Update composer:

```
$ composer update

```

#### Step 2) Publish Configurations

[](#step-2-publish-configurations)

Run following command:

```
php artisan vendor:publish --provider="Keensoen\CPanelApi\CPanelApiServiceProvider"

```

#### Step 3) Set CPanel details in `.env`

[](#step-3-set-cpanel-details-in-env)

```
CPANEL_DOMAIN=
CPANEL_PORT=
CPANEL_API_TOKEN=
CPANEL_USERNAME=

```

or

```
$cpanel = new CPanel($cpanel_domain=null, $cpanel_api_token=null, $cpanel_username=null, $protocol='https', $port=2083);
```

To generate `CPANEL_API_TOKEN`, login to the `CPanel >> SECURITY >> Manage API Tokens >> Create`.

Usages &amp; available methods
------------------------------

[](#usages--available-methods)

Make sure you import:

```
use Keensoen\CPanelApi\CPanel;
```

#### To Get List of All Email Account in the CPanel

[](#to-get-list-of-all-email-account-in-the-cpanel)

```
$cpanel = new CPanel();
$response = $cpanel->getEmailAccounts();
```

#### Create Email Account

[](#create-email-account)

Your password must be eight character above and should contain alphanumeric and symbols. For example

```
$cpanel = new CPanel()
$username = 'john.dansy';
$password = 'ideaHeals@#12';
$response = $cpanel->createEmailAccount($username, $password);
```

#### To Delete Email Account

[](#to-delete-email-account)

You will have to pass a full email address to be able to delete the account.

```
$cpanel = new CPanel()
$response = $cpanel->deleteEmailAccount('john.dansy@example.com');
```

#### To Get Email Account Disk Usage

[](#to-get-email-account-disk-usage)

You will have to pass a full email address of which you want to get disk usage.

```
$cpanel = new CPanel()
$response = $cpanel->getDiskUsage('john.dansy@example.com');
```

#### To Increase Email Account Quota

[](#to-increase-email-account-quota)

You will have to pass a full email address of which you want to get disk usage.

```
$cpanel = new CPanel()
$email = 'john.dansy@example.com';
$quota = 1024;
$response = $cpanel->increaseQuota($email,$quota);
```

#### To Create Database

[](#to-create-database)

Database name should be prefixed with cpanel username `cpanelusername_databasename`

If your CPanel username is `surf` then your database name | should be `surf_website`.

```
$cpanel = new CPanel();
$response = $cpanel->createDatabase('cpanelusername_databasename');
```

Find More Details at [CPanel UAPI - Mysql::create\_database](https://documentation.cpanel.net/display/DD/UAPI+Functions+-+Mysql::create_database)

#### To Delete Database

[](#to-delete-database)

```
$cpanel = new CPanel();
$response = $cpanel->deleteDatabase('cpanelusername_databasename');
```

[CPanel UAPI - Mysql::delete\_database](https://documentation.cpanel.net/display/DD/UAPI+Functions+-+Mysql%3A%3Adelete_database)

#### To Get List of All Databases in the CPanel

[](#to-get-list-of-all-databases-in-the-cpanel)

```
$cpanel = new CPanel();
$response = $cpanel->listDatabases();
```

#### To Create Database User

[](#to-create-database-user)

```
$cpanel = new CPanel();
$response = $cpanel->createDatabaseUser($username, $password);
```

#### To Delete Database User

[](#to-delete-database-user)

```
$cpanel = new CPanel();
$response = $cpanel->deleteDatabaseUser($username);
```

#### To Give All Privileges to a Database User On a Database

[](#to-give-all-privileges-to-a-database-user-on-a-database)

```
$cpanel = new CPanel();
$response = $cpanel->setAllPrivilegesOnDatabase($database_user, $database_name);
```

#### Using CPanel UAPI Methods

[](#using-cpanel-uapi-methods)

You can also call all the method available at [CPanel UAPI](https://documentation.cpanel.net/display/DD/Guide+to+UAPI) using following method:

```
$cpanel = new CPanel();
$response = $cpanel->callUAPI($Module, $function, $parameters);
```

for example if you want to add new `ftp` account, documetation is available at [CPanel UAPI - Ftp::add\_ftp](https://documentation.cpanel.net/display/DD/UAPI+Functions+-+Ftp%3A%3Aadd_ftp) then use the method as represented below:

```
$cpanel = new CPanel();
$Module = 'Ftp';
$function = 'add_ftp';
$parameters_array = [
'user'=>'ftp_username',
'pass'=>'ftp_password', //make sure you use strong password
'quota'=>'42',
];
$response = $cpanel->callUAPI($Module, $function, $parameters_array);
```

### Changelog

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

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

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

### Security

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Agbadu Daniel S.](https://github.com/keensoen)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity49

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

3

Last Release

1866d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/496fea9db630a8f17ad6e2ba2501c5e367ab31c6584a09f2e8bd57be0936cd75?d=identicon)[keensoen](/maintainers/keensoen)

---

Top Contributors

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

---

Tags

cpanel-apikeensoen

### Embed Badge

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

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

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M475](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M270](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M186](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M33](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M452](/packages/google-gax)

PHPackages © 2026

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