webreinvent/laravel-cpanel
Composer 安装命令:
composer require webreinvent/laravel-cpanel
包简介
Laravel Package of CPanel API 2.0
README 文档
README
Laravel Package for CPanel UAPI
Please consider starring the project to show your ❤️ and support.
This laravel package allows you to manage you CPanel based hosting using CPanel UAPI.
Some practical usages are:
- Programmatically create database, sub domains, emails or accounts etc
- Programmatically create database users
- Programmatically set privileges on database of any user
Learn more about at CPanel UAPI
Installation
Step 1) Install the Package
Use following composer command to install the package
composer require webreinvent/laravel-cpanel
or
Add webreinvent/laravel-cpanel as a requirement to composer.json:
{
...
"require": {
...
"webreinvent/laravel-cpanel": "dev-master"
},
}
Update composer:
$ composer update
Step 2) Register the ServiceProvider
Add following service provider in config/app.php
/* * Package Service Providers... */ 'providers' => [ //... WebReinvent\CPanel\CPanelServiceProvider::class, //... ],
Step 3) Publish Configurations
Run following command:
php artisan vendor:publish --provider="WebReinvent\CPanel\CPanelServiceProvider" --tag=config
Step 4) 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 WebReinvent\CPanel\CPanel;
To Create Database
Database name should be prefixed with cpanel username cpanelusername_databasename
If your CPanel username is foo then your database name
| should be foo_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);
Those were the available method but you can also call all the method available at CPanel UAPI using following method:
$cpanel = new CPanel(); $response = $cpanel->callUAPI($Module, $function, $parameters_array);
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);
Support us
WebReinvent is a web agency based in Delhi, India. You'll find an overview of all our open source projects on github.
License
The MIT License (MIT). Please see License File for more information.
webreinvent/laravel-cpanel 适用场景与选型建议
webreinvent/laravel-cpanel 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 9.77k 次下载、GitHub Stars 达 27, 最近一次更新时间为 2019 年 11 月 30 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「laravel」 「cpanel」 「CPanel API」 「cpanel uapi」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 webreinvent/laravel-cpanel 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 webreinvent/laravel-cpanel 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 webreinvent/laravel-cpanel 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Laravel cPanel/WHM API Package.
A PSR-7 compatible library for making CRUD API endpoints
Cpanel Licensing Class
Cpanel Licensing Class
MyAdmin cPanel Webhosting Plugin - Provides cPanel and WHM integration for the MyAdmin control panel, including account provisioning, DNS management, reseller configuration, and XML-API client functionality.
Cpanel Addon for VPS Module in MyAdmin
统计信息
- 总下载量: 9.77k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 27
- 点击次数: 28
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-11-30