marcuspmd/cpanel-uapi-php-class
Composer 安装命令:
composer require marcuspmd/cpanel-uapi-php-class
包简介
A class forked from N1ghteyes
关键字:
README 文档
README
PHP class to provide an easy-to-use interface with cPanel's UAPI and API2. Uses PHP magic functions to provide a simple and powerful interface.
v2.0 is not backwards compatible with v1.x, and will likley undergo a few more changes. See the changelog for details.
The class has been renamed to cpanelAPI.
Some more testing is required.
- Note while this class is not depricated, there is a new Agnostic API class available which will do everything this class does (except 2FA) and works with any RESTful / HTTP API - basically anything thats not SOAP. https://github.com/N1ghteyes/apicore
Usage
If you choose to use this class, please Star it in Github. This gives me a better idea of the number of users and those effected when changes are made.
See the example files, but typical usage takes the form of:
Instantiate the class
$cPanel = new cpanelAPI('user', 'password', 'cpanel.example.com');
The API we want to use and the Module (also called Scope) are now protected and are set by __get().
The request layout looks like this: $cPanel->api->method->Module->request(args[])
The ->method part should be replaced with ->get for GET requests and ->post for POST requests, or omitted to default to GET requests.
As an example, suppose we want to use the UAPI to call the Mysql::get_server_information function:
$response = $cPanel->uapi->Mysql->get_server_information(); var_dump($response);
Now that we have set both the API and the Module, we can call other functions within this API and Module without specifying them again:
$response = $cPanel->create_database(['name' => $cPanel->user.'_MyDatabase']); var_dump($response);
We can also change the Module scope without respecifying the API. Note that the Module call is case-sensitive.
$response = $cPanel->SSL->list_certs();
File upload example
$cPanel = new cpanelAPI($username, $password, $hostname); $cPanel->uapi->post->Fileman ->upload_files(['dir' => REMOTE_PATH_RELATIVE_TO_HOME, 'file-1' => new CURLFile(LOCAL_PATH_TO_FILE) ]);
API2
API2 is used in exactly the same way as the UAPI
$cPanel = new cpanelAPI('user', 'password', 'cpanel.example.com');
For example, suppose we want to use the API2 to add a subdomain:
$response = $cPanel->api2->SubDomain->addsubdomain(['rootdomain' => 'domain.com', 'domain' => 'sub']); var_dump($response);
Two-Factor Authentication
To use this class on a cPanel instance with two-factor authentication (2FA), you need to pass the secret into the class constructor:
$cPanel = new cpanelAPI('user', 'password', 'cpanel.example.com', 'secret');
The secret can be found on the 2FA setup page. See Two-Factor Authentication for cPanel – Configure two-factor authentication for details.
marcuspmd/cpanel-uapi-php-class 适用场景与选型建议
marcuspmd/cpanel-uapi-php-class 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 13 次下载、GitHub Stars 达 0, 最近一次更新时间为 2024 年 07 月 19 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「cpanel」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 marcuspmd/cpanel-uapi-php-class 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 marcuspmd/cpanel-uapi-php-class 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 marcuspmd/cpanel-uapi-php-class 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Laravel cPanel/WHM API Package.
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
Utilities for CakePHP 3.x
统计信息
- 总下载量: 13
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 30
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2024-07-19