darthsoup / laravel-whmcs
WHMCS API interface for Laravel 7.0 and up
Installs: 24 301
Dependents: 0
Suggesters: 0
Security: 0
Stars: 57
Watchers: 10
Forks: 21
Open Issues: 3
Requires
- php: ^7.4|^8.0
- ext-json: *
- darthsoup/php-whmcs-api: ~1.3
- graham-campbell/manager: ^5.1
- illuminate/events: ^8.0|^9.0|^10.0|^11.0
- illuminate/session: ^8.0|^9.0|^10.0|^11.0
- illuminate/support: ^8.0|^9.0|^10.0|^11.0
Requires (Dev)
- guzzlehttp/guzzle: ^7.0
- http-interop/http-factory-guzzle: ^1.0
- mockery/mockery: ~1.3
- nunomaduro/larastan: ^1.0.4
- orchestra/testbench: ^5.0|^6.0|^7.0|^8.0
- phpunit/phpunit: ^9.3
Suggests
- guzzlehttp/guzzle: A PSR-18 compatible HTTP Client (^7.0)
- dev-main
- 1.3.0.x-dev
- 1.2.2
- 1.2.1
- 1.2.0
- 1.1.0
- 1.0.0
- 1.0.0-beta.1
- 0.3.2
- 0.3.1
- 0.3.0
- 0.2.6
- 0.2.5
- 0.2.4
- 0.2.3
- 0.2.2
- 0.2.1
- 0.2.0
- 0.1.3
- 0.1.2
- 0.1.1
- 0.1
- dev-dependabot/composer/nunomaduro/larastan-tw-2.9.8
- dev-dependabot/composer/phpunit/phpunit-tw-11.2
- dev-dependabot/composer/orchestra/testbench-tw-9.1.2
- dev-legacy
This package is auto-updated.
Last update: 2024-11-10 05:29:53 UTC
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.