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

ActiveLibrary[API Development](/categories/api)

mhasnainjafri/cpanel
====================

Laravel CPanel API Library for Managing cPanel Functionalities

v1.0.2(2y ago)2014.5k—9.5%1MITPHP

Since Jul 23Pushed 2y ago2 watchersCompare

[ Source](https://github.com/MHasnainJafri/cpanel)[ Packagist](https://packagist.org/packages/mhasnainjafri/cpanel)[ Docs](https://github.com/mhasnainjafri)[ RSS](/packages/mhasnainjafri-cpanel/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (4)Used By (0)

[![License](https://camo.githubusercontent.com/a1c5b44e2177cb01c006501371c1296b3bf812b289d10d483e7a16840d827826/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f4d4861736e61696e4a616672692f6370616e656c2e737667)](https://github.com/MHasnainJafri/cpanel/blob/master/LICENSE)[![Open Issues](https://camo.githubusercontent.com/b45f17e7fc8b46992fb82c5b1e4b6e8675ccb1a96c5dabec44512a9613e77650/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f4d4861736e61696e4a616672692f6370616e656c2e737667)](https://github.com/MHasnainJafri/cpanel/issues)[![Stars](https://camo.githubusercontent.com/05daaf71de7eca7b5e1292a7c31f0e3e456daef227499bc7d4a620fa6fa40988/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f4d4861736e61696e4a616672692f6370616e656c2e737667)](https://github.com/MHasnainJafri/cpanel/stargazers)[![Forks](https://camo.githubusercontent.com/ce870cda3d3b2bc6fde775d91804a9f4d1302ba7f442c684fb7580f987d266f1/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f666f726b732f4d4861736e61696e4a616672692f6370616e656c2e737667)](https://github.com/MHasnainJafri/cpanel/network/members)

Library Name: Laravel CPanel API

This library provides a convenient way to interact with the cPanel API using Laravel. It allows you to perform various cPanel functions such as creating subdomains, managing databases, handling email accounts, and managing disk usage.

Installation

To use this library in your Laravel project, you can install it via Composer. Run the following command in your terminal:

```

composer require mhasnainjafri/cpanel

```

### Usage

[](#usage)

To get started, you need to create a new instance of the Cpanel class. There are two ways to initialize the class:

1. Without any parameters:

```
$cpanel = new Cpanel();
```

2. With parameters (if not defined in `.env` file):

```
$cpanel = new Cpanel($cpanel_domain, $cpanel_api_token, $cpanel_username, 'https', 2083);
```

Alternatively, you can set the cPanel credentials in the `.env` file:

```
CPANEL_DOMAIN=domain e.g : xyz.com
CPANEL_PORT=cpanel port (mostly is) 2083
CPANEL_API_TOKEN= Cpanel api token (To get api token view step 3)
CPANEL_USERNAME= Cpanel username

```

3. ### Steps to get Cpanel Api

    [](#steps-to-get-cpanel-api)

- search api in cpanel search bar
- click on `Manage api token`[![step 1](1.png)](1.png)
- Give token a name and click on create [![step 2](2.png)](2.png)
- Copy the token you get

### Subdomain Functions

[](#subdomain-functions)

To create a subdomain, use the `createSubDomain()` method:

```
$cpanel->createSubDomain('Sub domain e.g: web', 'domain e.g: xyz.com', 'Path where subdomain points e.g: /home/domain/public_html/subdomain');
```

### Database Functions

[](#database-functions)

To list all databases, use the `listDatabases()` method:

```
$cpanel->listDatabases();
```

To create a new database, use the `createDatabase()` method:

```
$cpanel->createDatabase('Database Name');
```

To delete a database, use the `deleteDatabase()` method:

```
$cpanel->deleteDatabase('Database Name');
```

To create a database user, use the `createDatabaseUser()` method:

```
$cpanel->createDatabaseUser('Database username', 'password');
```

To delete a database user, use the `deleteDatabaseUser()` method:

```
$cpanel->deleteDatabaseUser('Database username');
```

To set all privileges on a database for a user, use the `setAllPrivilegesOnDatabase()` method:

```
$cpanel->setAllPrivilegesOnDatabase('Database username', 'Database Name');
```

### Mail Functions

[](#mail-functions)

To create a POP email account, use the `createPopEmailAccount()` method:

```
$cpanel->createPopEmailAccount('mail@domain.com', 'password');
```

To delete a POP email account, use the `deletePopEmailAccount()` method:

```
$cpanel->deletePopEmailAccount('mail@domain.com');
```

To edit the mailbox quota for an email account, use the `editMailboxQuota()` method:

```
$cpanel->editMailboxQuota($email, $domain, $quota);
```

To dispatch client settings for an email account, use the `dispatchClientSettings()` method:

```
$cpanel->dispatchClientSettings('mail@domain.com', 'account');
```

To get the POP email count, use the `getPopEmailCount()` method:

```
$cpanel->getPopEmailCount();
```

### cPanel Disk Management

[](#cpanel-disk-management)

To get cPanel statistics bar stats for bandwidth usage or disk usage, use the `getCpanelStatsBarStats()` method:

```
$cpanel->getCpanelStatsBarStats('bandwidthusage|diskusage');
```

To get cPanel disk quota information, use the `getCpanelDiskQuotaInfo()` method:

```
$cpanel->getCpanelDiskQuotaInfo();
```

### Other API Functions

[](#other-api-functions)

To call any other cPanel API function, use the `callUAPI()` method:

```
$cpanel->callUAPI($Module, $function, $parameters_array = array());
```

Replace `$Module` with the desired module, `$function` with the function name, and `$parameters_array` with any additional parameters required by the API function.

That's it! You can now leverage the power of the Laravel CPanel API library to interact with the cPanel API seamlessly in your Laravel applications.

### Testing

[](#testing)

```
composer test
```

### 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)

- [Muhammad Hasnain](https://github.com/MHasnainJafri)
- [Muhammad Anas](https://github.com/MHasnainJafri)

License
-------

[](#license)

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

Laravel Package Boilerplate
---------------------------

[](#laravel-package-boilerplate)

This package was generated using the [Laravel Package Boilerplate](https://laravelpackageboilerplate.com).

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity35

Limited adoption so far

Community9

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

3

Last Release

1030d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0ac8f0e9f8ab4ade84cb363584a9d19051b1b0c412818d111ed1141795a02aca?d=identicon)[MHasnainJafri](/maintainers/MHasnainJafri)

---

Top Contributors

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

---

Tags

cpanel-apicpanel-serverscpanel-uapilaravellaravel-packagepacakgecpanellaravel-cpanel-apicpanel-apicpanel-librarycpanel-managementcpanel-utilitiescpanel-emailcpanel-databasecpanel-subdomaincpanel-disk-quotalaravel-cpanellaravel-cpanel-librarylaravel-cpanel-managementlaravel-cpanel-utilities

### Embed Badge

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

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

###  Alternatives

[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[facebook/php-business-sdk

PHP SDK for Facebook Business

90821.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

74513.7M114](/packages/meilisearch-meilisearch-php)[google/common-protos

Google API Common Protos for PHP

173103.7M50](/packages/google-common-protos)[hubspot/api-client

Hubspot API client

23914.2M16](/packages/hubspot-api-client)[zanysoft/cpanel-api

Cpanel's API

2810.8k](/packages/zanysoft-cpanel-api)

PHPackages © 2026

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