承接 keensoen/cpanel-api 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

keensoen/cpanel-api

最新稳定版本:v1.2

Composer 安装命令:

composer require keensoen/cpanel-api

包简介

cPanel API which enables you to connect and carry out several common task in the cpanel

README 文档

README

Latest Version on Packagist Build Status Quality Score Total Downloads

Laravel Package for CPanel UAPI

Please consider starring the project to show your ❤️ and support.

This laravel package allows you to connect and manage you CPanel based hosting using CPanel UAPI.

Some practical usages are:

  • Create database, sub domains, emails accounts etc
  • Create database users
  • Set privileges on database of any user
  • List all email account of the specified domain
  • Check email account size
  • Increase email quota when need arises
  • Delete email account when necessary

Learn more about at CPanel UAPI

Installation

Step 1) Install the Package

Use following composer command to install the package

composer require keensoen/cpanel-api 

or Add keensoen/cpanel-api as a requirement to composer.json:

{
    ...
    "require": {
        ...
        "keensoen/cpanel-api": "^1.0"
    },
}

Update composer:

$ composer update

Step 2) Publish Configurations

Run following command:

php artisan vendor:publish --provider="Keensoen\CPanelApi\CPanelApiServiceProvider"

Step 3) Set CPanel details in .env

CPANEL_DOMAIN= 
CPANEL_PORT=
CPANEL_API_TOKEN=
CPANEL_USERNAME=

or

$cpanel = new CPanel($cpanel_domain=null, $cpanel_api_token=null, $cpanel_username=null, $protocol='https', $port=2083);

To generate CPANEL_API_TOKEN, login to the CPanel >> SECURITY >> Manage API Tokens >> Create.

Usages & available methods

Make sure you import:

use Keensoen\CPanelApi\CPanel;

To Get List of All Email Account in the CPanel

$cpanel = new CPanel();  
$response = $cpanel->getEmailAccounts();

Create Email Account

Your password must be eight character above and should contain alphanumeric and symbols. For example

$cpanel = new CPanel()
$username = 'john.dansy';
$password = 'ideaHeals@#12';
$response = $cpanel->createEmailAccount($username, $password);

To Delete Email Account

You will have to pass a full email address to be able to delete the account.

$cpanel = new CPanel()
$response = $cpanel->deleteEmailAccount('john.dansy@example.com');

To Get Email Account Disk Usage

You will have to pass a full email address of which you want to get disk usage.

$cpanel = new CPanel()
$response = $cpanel->getDiskUsage('john.dansy@example.com');

To Increase Email Account Quota

You will have to pass a full email address of which you want to get disk usage.

$cpanel = new CPanel()
$email = 'john.dansy@example.com';
$quota = 1024;
$response = $cpanel->increaseQuota($email,$quota);

To Create Database

Database name should be prefixed with cpanel username cpanelusername_databasename

If your CPanel username is surf then your database name | should be surf_website.

$cpanel = new CPanel();
$response = $cpanel->createDatabase('cpanelusername_databasename');

Find More Details at CPanel UAPI - Mysql::create_database

To Delete Database

$cpanel = new CPanel();  
$response = $cpanel->deleteDatabase('cpanelusername_databasename');

CPanel UAPI - Mysql::delete_database

To Get List of All Databases in the CPanel

$cpanel = new CPanel();  
$response = $cpanel->listDatabases();

To Create Database User

$cpanel = new CPanel();  
$response = $cpanel->createDatabaseUser($username, $password);

To Delete Database User

$cpanel = new CPanel();  
$response = $cpanel->deleteDatabaseUser($username);

To Give All Privileges to a Database User On a Database

$cpanel = new CPanel();  
$response = $cpanel->setAllPrivilegesOnDatabase($database_user, $database_name);

Using CPanel UAPI Methods

You can also call all the method available at CPanel UAPI using following method:

$cpanel = new CPanel();  
$response = $cpanel->callUAPI($Module, $function, $parameters);

for example if you want to add new ftp account, documetation is available at CPanel UAPI - Ftp::add_ftp then use the method as represented below:

$cpanel = new CPanel();  
$Module = 'Ftp';
$function = 'add_ftp';
$parameters_array = [
'user'=>'ftp_username',
'pass'=>'ftp_password', //make sure you use strong password
'quota'=>'42',
];
$response = $cpanel->callUAPI($Module, $function, $parameters_array);

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email sesughagbadu@yahoo.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 1.54k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 2
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-03-29

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固