gregordusan / ispconfig-api-wrapper
ISPConfig 3 远程 API 的简单封装。
This package is auto-updated.
Last update: 2024-09-22 23:40:15 UTC
README
简介
ispconfig3远程API的简单封装。
基于仓库: pemedina/ispconfig-wrapper。
设计用于与ISPConfig 3交互,旨在提供一个简洁且具有表现力的接口,以执行API提供的所有操作。
要求
- PHP >= 7.4(需要 soap 支持)
入门
该库在ISPConfig 3 SOAP服务器和您的应用程序之间充当代理。所有函数都重命名为更具有表现力的 camelCase 语法。它 不会 进行任何验证,只是代理到相关的 SOAP 调用。唯一的改变是,每个响应都返回为 json 编码数组。
- 异常被捕获并转换为 json,包装为
errors。 - 单个值响应转换为 json,包装为
result。 - 数组响应转换为 json。
在ISPConfig中创建远程用户。
Composer
$ composer require gregordusan/ispconfig-api-wrapper dev-main
用法
该封装可以在任何 PHP 应用程序中包含和使用。
示例
具有表现力的语法。
<?php require_once 'vendor/autoload.php'; use ISPConfigWrapper\ISPConfigWS; $webService = new ISPConfigWS([ 'host' => 'https://domain.com:8080', // ispconfig url address 'user' => 'username', 'pass' => 'password', ]); // Get websites by username (using two calls below) // get client_id by username $result = $webService ->with([ 'username' => 'username', // ispconfig client username ]) ->getClientByUsername() ->response(); $client = json_decode($result); // get list of client websites $result = $webService ->with([ 'user_id' => $client->userid, 'group_id' => null, ]) ->getClientSites() ->response(); print_r(json_decode($result)); // Single call (change password for client_id = 1) $result = $webService ->with([ 'client_id' => 1, 'password' => 'newPassword', ]) ->changeClientPassword() ->response(); print_r(json_decode($result));
反馈和问题
发现了错误或缺少功能?请不要犹豫,在 GitHub 上创建新的问题。