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
Laravel WHMCS requires PHP ^7.4 | ^8.0 with at least Laravel version 6.
Install the package through Composer. Run the Composer require command from the Terminal:
composer require darthsoup/laravel-whmcsPackage 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::classTo get started, you'll need to publish vendor assets for Laravel-Whmcs.
php artisan vendor:publish --provider=DarthSoup\Whmcs\WhmcsServiceProviderThis will create the config/whmcs.php file in your app, modify it to set your configuration.
The option default is where you specify the default connection.
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.
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);
}
}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'
]);Obtain a list of client purchased products:
use \DarthSoup\Whmcs\Facades\Whmcs;
\Whmcs::Client()->getClientsProducts([
'clientid' => '12345'
]);Retrieve a specific invoice:
\Whmcs::Billing()->getInvoice([
'invoiceid' => '1337'
]);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
Please open an issue in github
This package is released under the MIT License. See the bundled LICENSE file for details.