fafan / cpanel-php
PHP版的Cpanel/WHM API
0.1.0
2016-10-10 03:30 UTC
Requires
- php: >=5.4
This package is not auto-updated.
Last update: 2024-09-28 19:58:17 UTC
README
PHP版的CPanel/WHM API库
注意:此库已从gufy/cpanel-php的原始代码进行修改
我重写了runQuery()函数,使用cURL而不是GuzzleHttp
内容
安装
要安装此包,您可以通过终端运行以下代码
composer require fafan/cpanel-php
或者更新您的composer.json
,添加以下行
"fafan/cpanel-php":"^0.1"
然后,运行以下代码
composer update
用法
例如,如果您想获取您的WHM服务器的账户列表,您可以这样做。
<?php $cpanel = new \Fafan\CpanelPhp\Cpanel([ 'host' => 'https://123.456.789.123:2087', // ip or domain complete with its protocol and port 'username' => 'root', // username of your server, it usually root. 'auth_type' => 'hash', // set 'hash' or 'password' 'password' => 'password', // long hash or your user's password ]); $accounts = $cpanel->listaccts(); // it will returned as array
函数
这是在创建新对象时定义配置的示例
<?php $cpanel = new \Fafan\CpanelPhp\Cpanel([ 'host' => 'https://123.456.789.123:2087', // required 'username' => 'root', // required 'auth_type' => 'hash', // optional, default 'hash' 'password' => 'password', // required ]);
某种程度上,您想要覆盖当前的配置。为此,以下是代码
<?php // change username andd (password or hash) $cpanel->setAuthorization($username, $password); // change host $cpanel->setHost($host); // change authentication type $cpanel->setAuthType($auth_type);
获取已定义的配置
定义了一些配置后,您可以通过调用此函数再次获取它
<?php // get username $cpanel->getUsername(); // get password $cpanel->getPassword(); // get authentication type $cpanel->getAuthType(); // get host $cpanel->getHost();
致谢
原始代码:gufy/cpanel-php,版本1.0
由Mochamad Gufron mgufronefendi@gmail.com