darthsoup/laravel-whmcs
Composer 安装命令:
composer require darthsoup/laravel-whmcs
包简介
WHMCS API interface for Laravel 8 and up
README 文档
README
An interface for interaction with the WHMCS API in Laravel. This Package is heavily inspired by Laravel GitLab created by Graham Campbell.
Notice:
The legacy version 0.3 can be found here
Installation
WHMCS API for Laravel requires PHP ^7.4 | ^8.0 with at least Laravel 8.
Install the package through Composer. Run the Composer require command from the Terminal:
composer require darthsoup/laravel-whmcs
Package will be installed automatically through composer package discovery. If not, then you need to register
the DarthSoup\Whmcs\WhmcsService service provider in your config/app.php.
Optionally, you can add the alias if you prefer to use the Facade:
'Whmcs' => DarthSoup\Whmcs\Facades\Whmcs::class
Configuration
To get started, you'll need to publish vendor assets for Laravel-Whmcs.
php artisan vendor:publish --provider="DarthSoup\Whmcs\WhmcsServiceProvider"
This will create the config/whmcs.php file in your app, modify it to set your configuration.
Default Connection
The option default is where you specify the default connection.
WHMCS Connections
The option connections is where you can add multiple connections to your whmcs instances.
You can choose between both API connection types from whmcs. These methods are password and token.
Example connections has been included, but you can add as many connections you would like.
Usage
via dependency injection
If you prefer to use Dependency Injection, you can easily add it to your controller as below:
use DarthSoup\Whmcs\WhmcsManager; class WhmcsController extends Controller { private WhmcsManager $whmcsManager; public function __construct(WhmcsManager $whmcsManager) { $this->whmcsManager = $whmcsManager; } public function index() { $result = $this->whmcsManager->client()->getClients(); dd($result); } }
Via Facade
If you prefer the classic Laravel facade style, this might be the way to go:
use \DarthSoup\Whmcs\Facades\Whmcs; # or use \Whmcs; \Whmcs::Client()->getClientsDomains(['clientid' => '1']);
Real examples
use \DarthSoup\Whmcs\Facades\Whmcs; # Obtaining a list of domains purchased by the customer \Whmcs::Client()->getClientsDomains(['clientid' => '1']); # Obtaining a list of products purchased by the customer \Whmcs::Client()->getClientsProducts(['clientid' => '12345']); # Retrieve a specific invoice \Whmcs::Billing()->getInvoice(['invoiceid' => '1337']); # Retrieves all Orders from the system \Whmcs::Orders()->getOrders(); # Obtain internal users \Whmcs::Users()->getUsers(['search' => 'foo@bar.org']); # Custom Method (in case you added custom endpoints) \Whmcs::Custom()-><myEndpoint>(['foo' => 'bar']);
For more information on how to use the WhmcsApi Client DarthSoup\WhmcsApi\Client class, check out the documentation
at https://github.com/darthsoup/php-whmcs-api.
Support
Please open an issue in github
License
This package is released under the MIT License. See the bundled LICENSE file for details.
darthsoup/laravel-whmcs 适用场景与选型建议
darthsoup/laravel-whmcs 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 37.16k 次下载、GitHub Stars 达 66, 最近一次更新时间为 2017 年 08 月 11 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 darthsoup/laravel-whmcs 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 darthsoup/laravel-whmcs 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 37.16k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 66
- 点击次数: 16
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-08-11