Repository: mgufrone/cpanel-php
Branch: master
Commit: dc697cce1bb8
Files: 12
Total size: 23.4 KB
Directory structure:
gitextract_s6_lq3c9/
├── .gitignore
├── .travis.yml
├── LICENSE
├── README.md
├── VERSION
├── composer.json
├── phpunit.xml
├── src/
│ └── Gufy/
│ └── CpanelPhp/
│ ├── Cpanel.php
│ ├── CpanelInterface.php
│ └── CpanelShortcuts.php
└── tests/
├── .gitignore
└── CpanelTest.php
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitignore
================================================
composer.lock
/vendor
================================================
FILE: .travis.yml
================================================
language: php
php:
- 5.6
- 7.4
- 7.1
before_script:
- composer self-update
- composer install --prefer-source --no-interaction
script:
- vendor/bin/phpunit
================================================
FILE: LICENSE
================================================
The MIT License (MIT)
Copyright (c) <2014> <Mochamad Gufron>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
================================================
FILE: README.md
================================================
## cPanel/WHM API for PHP library
## Contents
- [Installation Guide](#installation-guide)
- [Usage](#usage)
- [Functions](#functions)
- [Feedback & Contribution](#feedback-&-contribution)
### Installation Guide
To install this package, you can run this code via your terminal
```shell
composer require gufy/cpanel-php:~2.0
```
Or update your `composer.json` by adding this line
```json
"gufy/cpanel-php":"~2.0"
```
Then, run this code
```shell
composer update
```
### Usage
For example, if you would like to get list accounts of your whm server, you can do this.
```php
<?php
$cpanel = new \Gufy\CpanelPhp\Cpanel([
'host' => 'https://123.456.789.123:2087', // ip or domain complete with its protocol and port
'username' => 'root', // username of your server, it usually root.
'auth_type' => 'hash', // set 'hash' or 'password'
'password' => 'password', // long hash or your user's password
]);
$accounts = $cpanel->listaccts(); // it will returned as array
```
### Functions
- [Defining Configuration on constructor](#defining-configuration-on-constructor)
- [Usage](#usage)
- [Overriding Current configuration](#overriding-current-configuration)
- [Get defined configuration](#get-defined-configuration)
#### Defining Configuration on constructor
This is the example when you want to define your configuration while creating new object
```php
<?php
$cpanel = new \Gufy\CpanelPhp\Cpanel([
'host' => 'https://123.456.789.123:2087', // required
'username' => 'root', // required
'auth_type' => 'hash', // optional, default 'hash'
'password' => 'password', // required
]);
```
#### Usage
For example, you would like to get some list accounts from cPanel/WHM
```php
<?php
$accounts = $cpanel->listaccts();
// passing parameters
$accounts = $cpanel->listaccts(['searchtype'=>'domain', 'search'=>'', 'exact', 'search'=>'helloworld.com']);
// create account (Domain Name, Username, Password, Plan Slug)
createAccount(www.domain_name.com.br, 'user', 'pass', 'plan_basic');
```
For accessing cPanel API 2, you can use this.
```php
<?php
// get bandwidth data of specific cPanel's user
$data = $cpanel->cpanel('Bandwidth', 'getbwdata', 'username');
// removing cron line
$data = $cpanel->cpanel('Cron', 'remove_line', 'username', ['line'=>1]);
```
The first parameter must be Module you would like to get, second is function name, and the third is username of cPanel's user. There is fourth arguments, when function has some additional arguments, you can pass it there.
For accessing to cPanel API 1 or cPanel API 2 or UAPI, you can use this.
```php
<?php
// get bandwidth data of specific cPanel's user (using cPanel API 2)
$data = $cpanel->execute_action('2', 'Bandwidth', 'getbwdata', 'username');
// removing email address (using UAPI)
$data = $cpanel->execute_action('3', 'Email', 'delete_pop', 'username', ['email'=>'peter@griffin.com']);
```
This function is similar to the above, the only difference is that it has added a parameter which indicates the API you want to use (1 = cPanel API 1, 2 = cPanel API 2, 3 = UAPI), the other arguments are the same.
#### Overriding current configuration
Somehow, you want to override your current configuration. To do this, here is the code
```php
<?php
// change username andd (password or hash)
$cpanel->setAuthorization($username, $password);
// change host
$cpanel->setHost($host);
// change authentication type
$cpanel->setAuthType($auth_type);
```
#### Get defined configuration
After you define some of your configuration, you can get it again by calling this functions
```php
<?php
// get username
$cpanel->getUsername();
// get password
$cpanel->getPassword();
// get authentication type
$cpanel->getAuthType();
// get host
$cpanel->getHost();
```
#### Feedback and contribution
This package is free and open source, feel free to fork and report some issue to this package. :-). Have fun
================================================
FILE: VERSION
================================================
1.0.5
================================================
FILE: composer.json
================================================
{
"name": "gufy/cpanel-php",
"description": "Cpanel/WHM API for PHP",
"license": "MIT",
"authors": [
{
"name": "Mochamad Gufron",
"email": "mgufronefendi@gmail.com"
}
],
"require": {
"php": ">=5.6.0",
"guzzlehttp/guzzle":"~6"
},
"require-dev": {
"phpunit/phpunit": "^4.8"
},
"autoload": {
"psr-0": {
"Gufy\\CpanelPhp\\": "src/"
}
},
"minimum-stability": "stable"
}
================================================
FILE: phpunit.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
>
<testsuites>
<testsuite name="Package Test Suite">
<directory suffix=".php">./tests/</directory>
</testsuite>
</testsuites>
</phpunit>
================================================
FILE: src/Gufy/CpanelPhp/Cpanel.php
================================================
<?php namespace Gufy\CpanelPhp;
use GuzzleHttp\Client;
/**
* cPanel/WHM API
*
* Provides easy to use class for calling some CPanel/WHM API functions.
*
* @author Mochamad Gufron <mgufronefendi@gmail.com>
*
* @version v1.0.2
*
* @link https://github.com/mgufrone/cpanel-php
* @since v1.0.0
*/
class Cpanel implements CpanelInterface
{
use CpanelShortcuts;
/**
* @var string Username of your whm server. Must be string
*
* @since v1.0.0
*/
private $username;
/**
* @var string Password or long hash of your whm server.
*
* @since v1.0.0
*/
private $password;
/**
* @var string Authentication type you want to use. You can set as 'hash' or 'password'.
*
* @since v1.0.0
*/
private $auth_type;
/**
* @var string Host of your whm server. You must set it with full host with its port and protocol.
*
* @since v1.0.0
*/
private $host;
/**
* @var string Sets of headers that will be sent at request.
*
* @since v1.0.0
*/
protected $headers = array();
/**
* @var integer Query timeout (Guzzle option)
*
* @since v1.0.0
*/
protected $timeout = 10;
/**
* @var integer Connection timeout (Guzzle option)
*
* @since v1.0.0
*/
protected $connection_timeout = 2;
/**
* Class constructor. The options must be contain username, host, and password.
*
* @param array $options options that will be passed and processed
*
* @return self
* @since v1.0.0
*/
public function __construct($options = array())
{
if (!empty($options)) {
if (!empty($options['auth_type'])) {
$this->setAuthType($options['auth_type']);
}
return $this->checkOptions($options)
->setHost($options['host'])
->setAuthorization($options['username'], $options['password']);
}
}
/**
* Magic method who will call the CPanel/WHM Api.
*
* @param string $function function name that will be called
* @param array $arguments parameter that should be passed when calling API function
*
* @return array result of called functions
*
* @since v1.0.0
*/
public function __call($function, $arguments)
{
if (count($arguments) > 0)
$arguments = $arguments[0];
return $this->runQuery($function, $arguments);
}
/**
* checking options for 'username', 'password', and 'host'. If they are not set, some exception will be thrown.
*
* @param array $options list of options that will be checked
*
* @return self
* @throws \Exception
* @since v1.0.0
*/
private function checkOptions($options)
{
if (empty($options['username'])) {
throw new \Exception('Username is not set', 2301);
}
if (empty($options['password'])) {
throw new \Exception('Password or hash is not set', 2302);
}
if (empty($options['host'])) {
throw new \Exception('CPanel Host is not set', 2303);
}
return $this;
}
/**
* set authorization for access.
* It only set 'username' and 'password'.
*
* @param string $username Username of your whm server.
* @param string $password Password or long hash of your whm server.
*
* @return object return as self-object
*
* @since v1.0.0
*/
public function setAuthorization($username, $password)
{
$this->username = $username;
$this->password = $password;
return $this;
}
/**
* set API Host.
*
* @param string $host Host of your whm server.
*
* @return object return as self-object
*
* @since v1.0.0
*/
public function setHost($host)
{
$this->host = $host;
return $this;
}
/**
* set Authentication Type.
*
* @param string $auth_type Authentication type for calling API.
*
* @return object return as self-object
*
* @since v1.0.0
*/
public function setAuthType($auth_type)
{
$this->auth_type = $auth_type;
return $this;
}
/**
* set some header.
*
* @param string $name key of header you want to add
* @param string $value value of header you want to add
*
* @return object return as self-object
*
* @since v1.0.0
*/
public function setHeader($name, $value = '')
{
$this->headers[$name] = $value;
return $this;
}
/**
* set timeout.
*
* @param $timeout
*
* @return object return as self-object
*
* @since v1.0.0
*/
public function setTimeout($timeout)
{
$this->timeout = (int) $timeout;
return $this;
}
/**
* set connection timeout.
*
* @param $connection_timeout
*
* @return object return as self-object
*
* @since v1.0.0
*/
public function setConnectionTimeout($connection_timeout)
{
$this->connection_timeout = (int) $connection_timeout;
return $this;
}
/**
* get username.
*
* @return string return username
*
* @since v1.0.0
*/
public function getUsername()
{
return $this->username;
}
/**
* get authentication type.
*
* @return string get authentication type
*
* @since v1.0.0
*/
public function getAuthType()
{
return $this->auth_type;
}
/**
* get password or long hash.
*
* @return string get password or long hash
*
* @since v1.0.0
*/
public function getPassword()
{
return $this->password;
}
/**
* get host of your whm server.
*
* @return string host of your whm server
*
* @since v1.0.0
*/
public function getHost()
{
return $this->host;
}
/**
* get timeout.
*
* @return integer timeout of the Guzzle request
*
* @since v1.0.0
*/
public function getTimeout()
{
return $this->timeout;
}
/**
* get connection timeout.
*
* @return integer connection timeout of the Guzzle request
*
* @since v1.0.0
*/
public function getConnectionTimeout()
{
return $this->connection_timeout;
}
/**
* Extend HTTP headers that will be sent.
*
* @return array list of headers that will be sent
*
* @since v1.0.0
*/
private function createHeader()
{
$headers = $this->headers;
$username = $this->getUsername();
$auth_type = $this->getAuthType();
if ('hash' == $auth_type) {
$headers['Authorization'] = 'WHM ' . $username . ':' . preg_replace("'(\r|\n|\s|\t)'", '', $this->getPassword());
} elseif ('password' == $auth_type) {
$headers['Authorization'] = 'Basic ' . base64_encode($username . ':' .$this->getPassword());
}
return $headers;
}
/**
* The executor. It will run API function and get the data.
*
* @param string $action function name that will be called.
* @param array $arguments list of parameters that will be attached.
* @param bool $throw defaults to false, if set to true rethrow every exception.
*
* @throws Exception|GuzzleHttp\Exception\ClientException
*
* @return array results of API call
*
* @since v1.0.0
*/
protected function runQuery($action, $arguments = [], $throw = false)
{
$host = $this->getHost();
$client = new Client(['base_uri' => $host]);
try{
$response = $client->post('/json-api/' . $action, [
'headers' => $this->createHeader(),
'verify' => false,
'query' => $arguments,
'timeout' => $this->getTimeout(),
'connect_timeout' => $this->getConnectionTimeout()
]);
if (($decodedBody = json_decode($response->getBody(), true)) === false) {
throw new \Exception(json_last_error_msg(), json_last_error());
}
return $decodedBody;
}
catch(\GuzzleHttp\Exception\ClientException $e)
{
if ($throw) {
throw $e;
}
return $e->getMessage();
}
}
/**
* Use a cPanel API
*
* @param $module
* @param $function
* @param $username
* @param array $params
* @return mixed
* @throws \Exception
*/
public function cpanel($module, $function, $username, $params = array())
{
$action = 'cpanel';
$params = array_merge($params, [
'cpanel_jsonapi_version' => 2,
'cpanel_jsonapi_module' => $module,
'cpanel_jsonapi_func' => $function,
'cpanel_jsonapi_user' => $username,
]);
$response = $this->runQuery($action, $params);
return $response;
}
/**
* Use cPanel API 1 or use cPanel API 2 or use UAPI.
*
* @param $api (1 = cPanel API 1, 2 = cPanel API 2, 3 = UAPI)
* @param $module
* @param $function
* @param $username
* @param array $params
* @return mixed
* @throws \Exception
*/
public function execute_action($api, $module, $function, $username, $params = array())
{
$action = 'cpanel';
$params = array_merge($params, [
'cpanel_jsonapi_apiversion' => $api,
'cpanel_jsonapi_module' => $module,
'cpanel_jsonapi_func' => $function,
'cpanel_jsonapi_user' => $username,
]);
$response = $this->runQuery($action, $params);
return $response;
}
}
================================================
FILE: src/Gufy/CpanelPhp/CpanelInterface.php
================================================
<?php
namespace Gufy\CpanelPhp;
/**
* cPanel/WHM API
*
* Provides easy to use class for calling some CPanel/WHM API functions.
*
* @author Mochamad Gufron <mgufronefendi@gmail.com>
*
* @version v1.0.2
*
* @link https://github.com/mgufrone/cpanel-php
* @since v1.0.0
*/
interface CpanelInterface
{
/**
* set authorization for access.
* It only set 'username' and 'password'.
*
* @param string $username Username of your whm server.
* @param string $password Password or long hash of your whm server.
*
* @return object return as self-object
*
* @since v1.0.0
*/
public function setAuthorization($username, $password);
/**
* set API Host.
*
* @param string $host Host of your whm server.
*
* @return object return as self-object
*
* @since v1.0.0
*/
public function setHost($host);
/**
* set Authentication Type.
*
* @param string $auth_type Authentication type for calling API.
*
* @return object return as self-object
*
* @since v1.0.0
*/
public function setAuthType($auth_type);
/**
* set some header.
*
* @param string $name key of header you want to add
* @param string $value value of header you want to add
*
* @return object return as self-object
*
* @since v1.0.0
*/
public function setHeader($name, $value = '');
/**
* get username.
*
* @return string return username
*
* @since v1.0.0
*/
public function getUsername();
/**
* get authentication type.
*
* @return string get authentication type
*
* @since v1.0.0
*/
public function getAuthType();
/**
* get password or long hash.
*
* @return string get password or long hash
*
* @since v1.0.0
*/
public function getPassword();
/**
* get host of your whm server.
*
* @return string host of your whm server
*
* @since v1.0.0
*/
public function getHost();
/**
* Use a cPanel API
*
* @param $module
* @param $function
* @param $username
* @param array $params
* @return mixed
* @throws \Exception
*/
public function cpanel($module, $function, $username, $params = array());
}
================================================
FILE: src/Gufy/CpanelPhp/CpanelShortcuts.php
================================================
<?php namespace Gufy\CpanelPhp;
/**
* Trait CpanelShortcuts
*
* A handful of shortcuts for getting things done(tm)
*
* @package Gufy\CpanelWhm
*/
trait CpanelShortcuts
{
/**
* List all the accounts that the reseller has access to.
*
* @return mixed
*/
public function listAccounts()
{
return $this->runQuery('listaccts', []);
}
/**
* Create a new account
*
* @param $domain_name
* @param $username
* @param $password
* @param $plan
*
* @return mixed
*/
public function createAccount($domain_name, $username, $password, $plan)
{
return $this->runQuery('createacct', [
'username' => $username,
'domain' => $domain_name,
'password' => $password,
'plan' => $plan,
]);
}
/**
* This function deletes a cPanel or WHM account.
*
* @param string $username
*/
public function destroyAccount($username)
{
return $this->runQuery('removeacct', [
'username' => $username,
]);
}
/**
* Gets the email addresses that exist under a cPanel account
*
* @param $username
*/
public function listEmailAccounts($username)
{
return $this->cpanel('Email', 'listpops', $username);
}
/**
* Gets the forwarders that exist under a cPanel account
*
* @param $username
*/
public function listForwards($username)
{
return $this->cpanel('Email', 'listforwards', $username);
}
/**
* @param $username **cPanel username**
* @param $email email address to add
* @param $password password **for the email address**
* @return mixed
* @throws \Exception
*/
public function addEmailAccount($username, $email, $password)
{
list($account, $domain) = $this->split_email($email);
return $this->emailAction('addpop', $username, $password, $domain, $account);
}
/**
* Change the password for an email account in cPanel
*
* @param $username
* @param $email
* @param $password
* @return mixed
* @throws \Exception
*/
public function changeEmailPassword($username, $email, $password)
{
list($account, $domain) = $this->split_email($email);
return $this->emailAction('passwdpop', $username, $password, $domain, $account);
}
/**
* Runs a blank API Request to pull cPanel's response.
*
* @return array [status (0 is fail, 1 is success), error (internal error code), verbose (Extended error message)]
*/
public function checkConnection()
{
try {
$this->runQuery('', [], true);
} catch (\Exception $e) {
if ($e->hasResponse()) {
switch ($e->getResponse()->getStatusCode()) {
case 403:
return [
'status' => 0,
'error' => 'auth_error',
'verbose' => 'Check Username and Password/Access Key.'
];
default:
return [
'status' => 0,
'error' => 'unknown',
'verbose' => 'An unknown error has occurred. Server replied with: ' . $e->getResponse()->getStatusCode()
];
}
} else {
return [
'status' => 0,
'error' => 'conn_error',
'verbose' => 'Check CSF or hostname/port.'
];
}
return false;
}
return [
'status' => 1,
'error' => false,
'verbose' => 'Everything is working.'
];
}
/**
* Split an email address into two items, username and host.
*
* @param $email
* @return array
* @throws \Exception
*/
private function split_email($email)
{
$email_parts = explode('@', $email);
if (count($email_parts) !== 2) {
throw new \Exception("Email account is not valid.");
}
return $email_parts;
}
/**
* Perform an email action
*
* @param $action
* @param $username
* @param $password
* @param $domain
* @param $account
* @return mixed
*/
private function emailAction($action, $username, $password, $domain, $account)
{
return $this->cpanel('Email', $action, $username, [
'domain' => $domain,
'email' => $account,
'password' => $password,
]);
}
}
================================================
FILE: tests/.gitignore
================================================
PrivateTest.php
================================================
FILE: tests/CpanelTest.php
================================================
<?php
use Gufy\CpanelPhp\Cpanel;
class CpanelTest extends PHPUnit_Framework_TestCase
{
public function testConfiguration()
{
$cpanel = new Cpanel($options=array(
'host'=>'https://127.0.0.1:2087',
'username'=>'root',
'password'=>'password',
'auth_type'=>'password'
));
$this->assertEquals($options['host'], $cpanel->getHost());
$this->assertEquals($options['username'], $cpanel->getUsername());
$this->assertEquals($options['password'], $cpanel->getPassword());
$this->assertEquals($options['auth_type'], $cpanel->getAuthType());
}
}
gitextract_s6_lq3c9/
├── .gitignore
├── .travis.yml
├── LICENSE
├── README.md
├── VERSION
├── composer.json
├── phpunit.xml
├── src/
│ └── Gufy/
│ └── CpanelPhp/
│ ├── Cpanel.php
│ ├── CpanelInterface.php
│ └── CpanelShortcuts.php
└── tests/
├── .gitignore
└── CpanelTest.php
SYMBOL INDEX (43 symbols across 4 files)
FILE: src/Gufy/CpanelPhp/Cpanel.php
class Cpanel (line 17) | class Cpanel implements CpanelInterface
method __construct (line 78) | public function __construct($options = array())
method __call (line 101) | public function __call($function, $arguments)
method checkOptions (line 117) | private function checkOptions($options)
method setAuthorization (line 143) | public function setAuthorization($username, $password)
method setHost (line 160) | public function setHost($host)
method setAuthType (line 176) | public function setAuthType($auth_type)
method setHeader (line 193) | public function setHeader($name, $value = '')
method setTimeout (line 209) | public function setTimeout($timeout)
method setConnectionTimeout (line 225) | public function setConnectionTimeout($connection_timeout)
method getUsername (line 239) | public function getUsername()
method getAuthType (line 251) | public function getAuthType()
method getPassword (line 263) | public function getPassword()
method getHost (line 275) | public function getHost()
method getTimeout (line 287) | public function getTimeout()
method getConnectionTimeout (line 299) | public function getConnectionTimeout()
method createHeader (line 311) | private function createHeader()
method runQuery (line 339) | protected function runQuery($action, $arguments = [], $throw = false)
method cpanel (line 377) | public function cpanel($module, $function, $username, $params = array())
method execute_action (line 402) | public function execute_action($api, $module, $function, $username, $p...
FILE: src/Gufy/CpanelPhp/CpanelInterface.php
type CpanelInterface (line 17) | interface CpanelInterface
method setAuthorization (line 30) | public function setAuthorization($username, $password);
method setHost (line 41) | public function setHost($host);
method setAuthType (line 52) | public function setAuthType($auth_type);
method setHeader (line 64) | public function setHeader($name, $value = '');
method getUsername (line 73) | public function getUsername();
method getAuthType (line 82) | public function getAuthType();
method getPassword (line 91) | public function getPassword();
method getHost (line 100) | public function getHost();
method cpanel (line 112) | public function cpanel($module, $function, $username, $params = array());
FILE: src/Gufy/CpanelPhp/CpanelShortcuts.php
type CpanelShortcuts (line 10) | trait CpanelShortcuts
method listAccounts (line 17) | public function listAccounts()
method createAccount (line 32) | public function createAccount($domain_name, $username, $password, $plan)
method destroyAccount (line 47) | public function destroyAccount($username)
method listEmailAccounts (line 59) | public function listEmailAccounts($username)
method listForwards (line 69) | public function listForwards($username)
method addEmailAccount (line 81) | public function addEmailAccount($username, $email, $password)
method changeEmailPassword (line 97) | public function changeEmailPassword($username, $email, $password)
method checkConnection (line 109) | public function checkConnection()
method split_email (line 153) | private function split_email($email)
method emailAction (line 173) | private function emailAction($action, $username, $password, $domain, $...
FILE: tests/CpanelTest.php
class CpanelTest (line 3) | class CpanelTest extends PHPUnit_Framework_TestCase
method testConfiguration (line 5) | public function testConfiguration()
Condensed preview — 12 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (26K chars).
[
{
"path": ".gitignore",
"chars": 22,
"preview": "composer.lock\n/vendor\n"
},
{
"path": ".travis.yml",
"chars": 157,
"preview": "language: php\nphp:\n- 5.6\n- 7.4\n- 7.1\nbefore_script:\n- composer self-update\n- composer install --prefer-source --no-inter"
},
{
"path": "LICENSE",
"chars": 1086,
"preview": "The MIT License (MIT)\n\nCopyright (c) <2014> <Mochamad Gufron>\n\nPermission is hereby granted, free of charge, to any pers"
},
{
"path": "README.md",
"chars": 4022,
"preview": "## cPanel/WHM API for PHP library\n\n## Contents\n- [Installation Guide](#installation-guide)\n- [Usage](#usage)\n- [Function"
},
{
"path": "VERSION",
"chars": 6,
"preview": "1.0.5\n"
},
{
"path": "composer.json",
"chars": 505,
"preview": "{\n \"name\": \"gufy/cpanel-php\",\n \"description\": \"Cpanel/WHM API for PHP\",\n \"license\": \"MIT\",\n \"authors\": [\n "
},
{
"path": "phpunit.xml",
"chars": 570,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<phpunit backupGlobals=\"false\"\n backupStaticAttributes=\"false\"\n b"
},
{
"path": "src/Gufy/CpanelPhp/Cpanel.php",
"chars": 9924,
"preview": "<?php namespace Gufy\\CpanelPhp;\n\nuse GuzzleHttp\\Client;\n\n/**\n * cPanel/WHM API\n *\n * Provides easy to use class for call"
},
{
"path": "src/Gufy/CpanelPhp/CpanelInterface.php",
"chars": 2361,
"preview": "<?php\nnamespace Gufy\\CpanelPhp;\n\n\n/**\n * cPanel/WHM API\n *\n * Provides easy to use class for calling some CPanel/WHM API"
},
{
"path": "src/Gufy/CpanelPhp/CpanelShortcuts.php",
"chars": 4748,
"preview": "<?php namespace Gufy\\CpanelPhp;\n\n/**\n * Trait CpanelShortcuts\n *\n * A handful of shortcuts for getting things done(tm)\n "
},
{
"path": "tests/.gitignore",
"chars": 16,
"preview": "PrivateTest.php\n"
},
{
"path": "tests/CpanelTest.php",
"chars": 589,
"preview": "<?php\nuse Gufy\\CpanelPhp\\Cpanel;\nclass CpanelTest extends PHPUnit_Framework_TestCase\n{\n public function testConfigurati"
}
]
About this extraction
This page contains the full source code of the mgufrone/cpanel-php GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 12 files (23.4 KB), approximately 6.5k tokens, and a symbol index with 43 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.