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

ActiveLibrary[API Development](/categories/api)

zanysoft/cpanel-api
===================

Cpanel's API

v3.2(3y ago)2810.8k↑33.3%16MITPHPPHP &gt;=7.4CI passing

Since Jan 27Pushed 1y ago1 watchersCompare

[ Source](https://github.com/zanysoft/cpanel-api)[ Packagist](https://packagist.org/packages/zanysoft/cpanel-api)[ RSS](/packages/zanysoft-cpanel-api/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (6)Dependencies (1)Versions (8)Used By (0)

Cpanel's API
============

[](#cpanels-api)

Cpanel's API 1 and 2 for Laravel

Contents
--------

[](#contents)

- [Installation Guide](#installation-guide)
- [Configuration](#configuration)
- [Usage](#usage)
- [Functions](#functions)
- [Documentation](#documentation)

### Installation Guide

[](#installation-guide)

Require this package in your composer.json and update composer. This will download the package.

```
composer require zanysoft/cpanel-api

```

If using &lt; Laravel 5.5, add the ServiceProvider and Aliases in config/app.php

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

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

```

### Configuration

[](#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:

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

```

### Usage

[](#usage)

You can create a new Cpanel instance.

```
$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:

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

```

You can use the facade with chain the methods:

```
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.

```
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.

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

```

### Functions

[](#functions)

This is the example when you want to define your configuration

```
