2017 © Pedro Peláez
 

library cpanel-api

Cpanel's API

image

zanysoft/cpanel-api

Cpanel's API

  • Monday, May 29, 2017
  • by mubasharahmad
  • Repository
  • 1 Watchers
  • 6 Stars
  • 214 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 7 Forks
  • 3 Open issues
  • 3 Versions
  • 34 % Grown

The README.md

Cpanel's API

Cpanel's API 1 and 2 for Laravel, (*1)

Contents

Installation Guide

Require this package in your composer.json and update composer. This will download the package., (*2)

composer require zanysoft/cpanel-api

If using < Laravel 5.5, add the ServiceProvider and Aliases in config/app.php, (*3)

'providers' => [
    '...',
    ZanySoft\Cpanel\CpanelServiceProvider::class,
];

'aliases' => [
    '...',
    'Cpanel' => ZanySoft\Cpanel\Facades\Cpanel::class,
];

Configuration

The defaults configuration settings are set in config/cpanel.php. Copy this file to your own config directory to modify the values. You can publish the config using this command:, (*4)

php artisan vendor:publish --provider="ZanySoft\Cpanel\CpanelServiceProvider"

Usage

You can create a new Cpanel instance., (*5)

$cpanel = Cpanel::make();
$cpanel->setHost($host_ip);
$cpanel->setAuth($username, $password) //if you don't want to set in config file
return $cpanel->api2($user, $module, $function, $args = array());

Or use the facade:, (*6)

return Cpanel::api2($user, $module, $function, $args = array());

You can use the facade with chain the methods:, (*7)

return Cpanel::setHost($host_ip)->setAuth($username, $password)->api2($user, $module, $function, $args = array());

You can set the authentication before chain if you don't want to set this in config/cpanel.php file., (*8)

return Cpanel::setAuth($username, $password)->api2($user, $module, $function, $args = array());

You can set host, username and pasword on createing instance if you don't want to set this in config/cpanel.php file., (*9)

$cpanel = new \ZanySoft\Cpanel\Cpanel($host,$username, $password);
// OR
$cpanel = Cpanel::make($host,$username, $password);

Functions

This is the example when you want to define your configuration, (*10)

  <?php
    $cpanel = App::make('cpanel');
    $cpanel->setHost($host_ip);
    $cpanel->setAuth($username, $password)
    return $cpanel->api2($user, $module, $function, $args = array());

If you like to get some list accounts from cPanel/WHM, (*11)

    <?php

    $accounts = $cpanel->listaccts();
    // passing parameters
    $accounts = $cpanel->listaccts($searchtype, $search);

If you want to create new subdomain, (*12)

    <?php

    // createSubdomain(Domain Name, Username, Dubdomain Directory, Main Domain)
         $cpanel->createSubdomain('subdomain', 'username', '/public_html/subdomain', 'example.com')

For accessing cPanel API 2, you can use this., (*13)

    <?php

    return $cpanel->api2($user, $module, $function, $args = array());

For accessing cPanel API 1, you can use this., (*14)

    <?php

    return $cpanel->api1($user, $module, $function, $args = array());

Documentation

Visit this link for api2 options: https://documentation.cpanel.net/display/SDK/Guide+to+cPanel+API+2, (*15)

Visit this link for api1 options: https://documentation.cpanel.net/display/SDK/Guide+to+cPanel+API+1, (*16)

The Versions

29/05 2017

v1.1

1.1.0.0

Cpanel's API

  Sources   Download

MIT

29/05 2017

dev-master

9999999-dev

Cpanel's API

  Sources   Download

MIT

27/01 2017

v1.0

1.0.0.0

Cpanel's API

  Sources   Download

MIT

by Mubashar Ahmad Nasir