Bloby / laravel-whmcs by Bloby

A simple Laravel interface for interacting with the WHMCS API.
30
0
1
Package Data
Maintainer Username: Bloby
Package Create Date: 2017-07-29
Package Last Update: 2018-06-20
Language: PHP
License: MIT
Last Refreshed: 2024-04-25 15:16:17
Package Statistics
Total Downloads: 30
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 0
Total Watchers: 1
Total Forks: 0
Total Open Issues: 0

laravel-whmcs

NOTE: This package is no longer in active development. Feel free to fork and extend it as needed.

A simple Laravel interface for interacting with the WHMCS API.

Installation

To install the package, simply add the following to your Laravel installation's composer.json file:

"require": {
	"laravel/framework": "5.*",
	"blob/laravel-whmcs": "dev-master"
},

Run composer update to pull in the files.

Then, add the following Service Provider to your providers array in your config/app.php file:

'providers' => array(
	...
	WHMCS\Providers\WHMCSClientServiceProvider::class,
	WHMCS\Providers\WHMCSInvoiceServiceProvider::class,
	WHMCS\Providers\WHMCSMiscServiceProvider::class,
	WHMCS\Providers\WHMCSModuleServiceProvider::class,
	WHMCS\Providers\WHMCSOrderServiceProvider::class,
	WHMCS\Providers\WHMCSProductsServiceProvider::class,
	WHMCS\Providers\WHMCSQuoteServiceProvider::class,
	WHMCS\Providers\WHMCSTicketServiceProvider::class,
);

From the command-line run: php artisan vendor:publish

Configuration

Open config/whmcs.php and configure the api endpoint and credentials:

return [
	// API URL
	'url'		=>	'http://url.com/whmcs/includes/api.php',

	// API USERNAME
	'username'	=>	'admin_user',

	// API PASSWORD
	'password'	=>	'password123',

    // API PASSWORD HASHED
    'hashed_password' => false,

	// API RESPONSE TYPE
	'response_type'	=> 'json', // json or xml
];

Usage

// app/Http/routes.php

Route::get('/products/{client_id}', function() {

    $start = 0;
    $limit = 25;

    $products = WHMCSClient::getClientProducts($client_id, $start, $limit);

    return json_encode($products);
});

WHMCS Docs

http://docs.whmcs.com/API