ouchestechnology / whm-php
php whm cpanel 管理器
v1.0.0
2023-07-28 12:41 UTC
This package is auto-updated.
Last update: 2024-09-30 02:05:26 UTC
README
介绍
Ouchestechnology/whm-php 是一个 Laravel 扩展包,它提供了一个方便的 cPanel API 封装,允许您以编程方式与 cPanel 账户进行交互并执行各种操作。安装
您可以通过 composer 安装此包
bash
composer require ouchestechnology/whm-php
配置
Add the service provider to the config/app.php file:
'providers' => [
// Other providers...
Ouchestechnology\WhmPhp\WhmPackageServiceProvider::class,
],
将包配置添加到您的 Laravel 应用程序的 config/services.php 文件中
'whm' => [
'base_url' => env('BASE_URL'),
'api_key' => env('WHM_API_KEY'),
],
在您的 Laravel 应用程序中打开 .env 文件,并添加以下 cPanel 凭据
BASE_URL=https://your-cpanel-host.com
CPANEL_USERNAME=your_cpanel_username
CPANEL_PASSWORD=your_cpanel_password
WHM_API_KEY=your_api_key
将 https://your-cpanel-host.com、your_cpanel_username 和 your_cpanel_password 替换为您实际的 cPanel 凭据。
使用方法
创建 cPanel 账户
use Ouchestechnology\WhmPhp\CpanelApi;
$cpanel = new CpanelApi(config('cpanel.base_url'), config('cpanel.username'), config('cpanel.password'));
创建一个新的 cPanel 账户
$response = $cpanel->createCpanelAccount('newaccount', 'example.com', 'secretpassword');
获取所有托管套餐
$response = $cpanel->getAllHostingPackages();
获取所有 cPanel 用户
$response = $cpanel->getAllUsers();
获取所有托管套餐
$response = $cpanel->getAllHostingPackages();
Ouchestechnology/whm-php 是开源软件,遵循 MIT 许可证。