freshost/ispconfig-wrapper

ISPConfig 3 远程 API 的简单包装器。

dev-master 2023-03-25 15:52 UTC

This package is auto-updated.

Last update: 2024-09-26 21:34:54 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服务器和您的应用程序之间充当代理。所有函数都被重命名为更具有表达性的(在我看来)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上创建一个新的问题。