gohrco / whmcsapi

此包最新版本(v1.0.0)没有可用的许可信息。

WHMCS v6.0及以上版本的API接口处理器

v1.0.0 2016-04-25 20:29 UTC

This package is not auto-updated.

Last update: 2024-09-20 19:24:59 UTC


README

概要

WHMCS v6.0及以上版本的API接口处理器

安装

使用以下命令安装最新版本:

$ composer require gohrco/whmcsapi

基本用法

<?php

use Gohrco\Whmcsapi;

// create an API handler
$api		=	new Whmcsapi();

// Set options
$api->setUsername( 'apiadmin' );
$api->setPassword( 'password' );
$api->setUrl( 'http://url.to.your/whmcs/' );
$api->setLogpath( '\absolute\path\to\log\entries' );

// Init
$api->init();

// Call API up
$result		=	$api->getclientsdetails( array( 'userid' => 1 ) );

API参考

在创建API处理器时,您还可以将选项作为数组传递,例如:

$api    = new Whmcsapi( array( 'username' => 'apiadmin', 'password' => 'password', 'url' => 'http://url.to.your/whmcs/', 'logpath' => '\absolute\path\to\log\entries' ) );
$result = $api->getclientsproducts( array( 'userid' => 1 ) );

如果所有四个条目都存在,您可以跳过init()调用,因为这会为您完成。

可以直接调用WHMCS支持的任何API方法作为对象的方法。例如

$api->addorder();
$api->getclients();
$api->addbannedip();
...