gbretas/php-whmcs-api

PHP 的 WHMCS API 客户端

1.0.0 2022-05-14 14:22 UTC

This package is auto-updated.

Last update: 2024-09-14 19:31:32 UTC


README

基于 https://github.com/gbretas/laravel-whmcs

https://packagist.org.cn/packages/gbretas/php-whmcs-api

安装

Composer

$ composer require "gbretas/php-whmcs-api" "guzzlehttp/guzzle:^7.4" "http-interop/http-factory-guzzle:^1.2"

系统要求

此包需要

  • PHP ^7.4 | ^8.0
  • PHP 扩展 curljsonmbstring

使用方法

初始化客户端

客户端的基本初始化。

<?php
require_once __DIR__ . '/vendor/autoload.php';
$client = new \gbretas\WhmcsApi\Client();
// Auth Credentials with identifier and secret
$client->authenticate('your_identifier', 'your_secret', \gbretas\WhmcsApi\Client::AUTH_API_CREDENTIALS);
// Login Credentials with Username and Password (without md5)
$client->authenticate('your_username', 'your_password', \gbretas\WhmcsApi\Client::AUTH_LOGIN_CREDENTIALS);
// Set the URL to your whmcs instance
$client->url('http://<your_whmcs_instance_url>');

API 访问密钥

如果您的实例在 whmcs 的 configuration.php 中配置了额外的 $api_access_key,您也可以在初始化过程中通过使用 accessKey 来添加它。

$client->accessKey('my_access_key');

示例

获取客户端

$client->client()->getClients(['search' => 'firstname']);

获取所有订单

$client->orders()->getOrders();

许可证

原始包是在 MIT 许可下发布的。有关详细信息,请参阅捆绑的 LICENSE 文件。