cPanel PHP Library
cPanel PHP Library for managing WHM & cPanel from any PHP application. Easy to use. Install with Composer and start using it., (*1)
Installation
Install it via Composer
bash
sudo composer install
, (*2)
copy and paste config.sample and rename it to config.php. Now replace all the variable in config file with your server url, root username and password., (*3)
And you are done!, (*4)
cPanel/WHM SDK Documentation
To use it you have to know the original cPanel/WHM documentation. All the commands and parameters are explained there.
Based on their documentation suppose you need to call a url to get an account summery with this /json-api/accountsummary?api.version=1&user=username url., (*5)
To call that url you have to write $request->build('accountsummary', array('params' => array('user' => 'username', 'api.version' => 1)))
. First parameter will be command name and second parameter will hold an array where you can pass additional url parameter with array('params' => array())
params key., (*6)
Usage
To get the list of Packages from your WHM., (*7)
$request = new \CpanelPhp\Cpanel\Request(WHMURL, WHMPORT);
$response = $request->build('listpkgs')->data;
print_r($response);
Note: if you face any problem please create issue in this repository, (*8)