cPanel/WHM API PHP
Manage your WHM/cPanel server with this PHP library. Simple to use. With this PHP library, you can manage your cPanel/WHM server., (*1)
, (*2)
Installation
You can install this library with composer., (*3)
composer require previewtechs/cpanel-whm-api:dev-master
Usage
<?php
require "vendor/autoload.php";
//Build WHM Client
use PreviewTechs\cPanelWHM\WHM\Accounts;
use PreviewTechs\cPanelWHM\WHMClient;
require "vendor/autoload.php";
$whmClient = new WHMClient("WHM_USERNAME","API_TOKEN", "yourwhmserver.com", 2087);
$accounts = new Accounts($whmClient);
var_dump($accounts->searchAccounts());
WHM Client
To access and use WHM related functionality you must need to build WHM client with configuration
and credentials., (*4)
To configure your WHM client, you must provide your WHM username (you use to login into your WHM panel) and API Token., (*5)
If you have an API token you can use that if proper permissions are configured, otherwise
you can create a new API token from your WHM., (*6)
Create API token from https://your-whm-server:2087/cpsessxxxxxx/scripts7/apitokens/home, (*7)
Learn more about WHM API Token from https://documentation.cpanel.net/display/64Docs/Manage+API+Tokens, (*8)
<?php
use PreviewTechs\cPanelWHM\WHMClient;
$whmClient = new WHMClient("WHM_USERNAME","API_TOKEN", "yourwhmserver.com", 2087);
Available Functionality
- WHM
- Accounts
- searchAccounts (List of all accounts)
- getDetails (Details of a specific account)
- create (Create a new account)
- availableFunctions (List of API functions available for current authenticated user)
- userDomainDetails (Get a hosted domain details)
- changeDiskSpaceQuota (Modify an user's disk space quota)
- forcePasswordChange (Force user to change their password at their next login)
- getDomains (List of domains exists in the server)
- hasDigestAuth (Digest auth is enabled or disabled)
- hasMyCnfInHomeDirectory (.my.cnf file exists in user's home directory or not)
- limitBandwidth (Modify bandwidth limit)
- getUsers (List of all users in server)
- getLockedAccounts (List of all locked accounts)
- getSuspendedAccounts (List of all suspended accounts)
- createUserSession()
- changePlan()
Contibutions
You are always welcome to contribute in this library., (*9)
See our list of contributors, (*10)
Issues/Bug Reports
Please create an issue or report a bug in this GitHub repository and we will be
happy to look into that., (*11)
License
The MIT License (MIT), (*12)
Copyright (c) 2014 Domain Reseller API, (*13)
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:, (*14)
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software., (*15)
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., (*16)