2017 © Pedro Peláez
 

library cpanel-php

Cpanel/WHM API for PHP

image

fafan/cpanel-php

Cpanel/WHM API for PHP

  • Monday, October 24, 2016
  • by fafan
  • Repository
  • 1 Watchers
  • 0 Stars
  • 19 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Code Climate Test Coverage Issue Count, (*1)

CPanel/WHM API for PHP library

NOTE: This library is modified from original code of gufy/cpanel-php, (*2)

I rewrite runQuery() function to use cURL instead of GuzzleHttp, (*3)

Contents

Installation

To install this package, you can run this code via your terminal, (*4)

    composer require fafan/cpanel-php

Or update your composer.json by adding this line, (*5)

    "fafan/cpanel-php":"^0.1"

Then, run this code, (*6)

    composer update

Usage

For example, if you would like to get list accounts of your whm server, you can do this., (*7)

  <?php
  $cpanel = new \Fafan\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

This is the example when you want to define your configuration while creating new object, (*8)

  <?php
  $cpanel = new \Fafan\CpanelPhp\Cpanel([
      'host'        =>  'https://123.456.789.123:2087', // required
      'username'    =>  'root', // required
      'auth_type'   =>  'hash', // optional, default 'hash'
      'password'    =>  'password', // required
  ]);

Somehow, you want to override your current configuration. To do this, here is the code, (*9)

  <?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, (*10)

  <?php
  // get username
  $cpanel->getUsername();

  // get password
  $cpanel->getPassword();

  // get authentication type
  $cpanel->getAuthType();

  // get host
  $cpanel->getHost();

Credits

Original code: gufy/cpanel-php, version 1.0, (*11)

By Mochamad Gufron mgufronefendi@gmail.com, (*12)

The Versions

24/10 2016

dev-master

9999999-dev

Cpanel/WHM API for PHP

  Sources   Download

MIT

The Requires

  • php >=5.4

 

by Avatar fafan

10/10 2016

0.1.0

0.1.0.0

Cpanel/WHM API for PHP

  Sources   Download

MIT

The Requires

  • php >=5.4

 

by Avatar fafan