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

简介

ispconfig3远程API的简单包装器。

设计用于与ISPConfig 3互操作,旨在提供一个简洁且易于使用的接口来执行API提供的所有操作。

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

要求

  • PHP >= 5.3.0(具有soap支持)

入门

该库在ISPConfig 3 SOAP服务器和您的应用程序之间充当代理。所有功能都重命名为更具表达力的(在我看来)驼峰式语法。它不会进行任何验证,仅代理每个请求到相关的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上创建新问题。