pemedina/ispconfig-wrapper

ISPConfig 3 远程 API 的简单封装。

dev-master 2022-03-22 10:39 UTC

This package is auto-updated.

Last update: 2024-09-22 16:09:51 UTC


README

简介

A simple wrapper for ispconfig3 remote API.

该封装旨在与 ISPConfig 3 交互,旨在提供一个简洁且易于表达的接口,以执行 API 提供的所有操作。

Latest Stable Version Total Downloads Latest Unstable Version License PHP Version Require

要求

  • PHP >= 5.3.0(支持 soap

入门

该库作为 ISPConfig 3 SOAP 服务器和您的应用程序之间的代理。所有函数都已重命名为更易表达的 camelCase 语法。它 进行任何验证,只是将每个请求代理到相关的 SOAP 调用。唯一的改变是,每个响应都以 json 编码数组的形式返回。

  • 异常将被捕获并转换为 json,包装为 errors
  • 单值响应将被转换为 json,包装为 result
  • 数组响应将被转换为 json。

Composer

$ composer require pemedina/ispconfig-wrapper 1.*

使用方法

该封装可以包含并用于任何 PHP 应用程序。

示例

易表达语法。

<?php
$webService = new ISPConfigWS(
    new \SoapClient(NULL,
        array('location'   => 'http://192.168.0.55/remote/index.php',
              'uri'        => 'http://192.168.0.55/remote/',
              'exceptions' => 0)
    )
);

// Login
$webService
    ->with(array('loginUser' => 'admin', 'loginPass' => 'password'))
    ->login();


$result = $webService
            ->with(array('client_id' => 5))
            ->getClient()
            ->response();

print_r json_decode( $result ));

// Single call

$result = $webService
            ->with(array('loginUser' => 'admin', 'loginPass' => 'password', 'password' => 'newPass', 'client_id' => 5))
            ->changeClientPassword()
            ->response();

print_r json_decode( $result ));

标准用法。

<?php
$webService = new ISPConfigWS(
    new \SoapClient(NULL,
        array('location'   => 'http://192.168.0.55/remote/index.php',
              'uri'        => 'http://192.168.0.55/remote/',
              'exceptions' => 0)
    )
);

$loginDetails = array('loginUser' => 'admin', 'loginPass' => 'password');
$webService->setParameters( $loginDetails );
$webService->login();
...
...
$parameters = array('client_id' => 5);
$webService->setParameters( $parameters );
$webService->getClient();

print_r json_decode( $webService->getResponse() ));

反馈和问题

发现了错误或缺少功能?请在这里的 GitHub 上创建一个新问题。