sermajid/laravel-whmcs

There is no license information available for the latest version (1.0.8) of this package.

laravel api whmcs

1.0.8 2020-10-17 20:21 UTC

This package is auto-updated.

Last update: 2024-05-18 04:59:08 UTC


README

A simple Laravel interface for interacting with the WHMCS API.

Installation

Install the package:

composer require sermajid/laravel-whmcs

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

'providers' => array(
	...
	sermajid\LaravelWhmcs\WhmcsServiceProvider::class,
);

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

Configuration

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

return [
    'url'	=>	env('WHMCS_URL', 'http://localhost/includes/api.php'),

    // API USERNAME
    'username'	=>	env('WHMCS_USERNAME','admin_user'),

    // API PASSWORD
    'password'	=> env('WHMCS_PASSWORD','password123'),

    // API RESPONSE TYPE
    'response_type'	=> env('WHMCS_RESPONSE_TYPE','json'),
];

Usage

// app/Http/routes.php

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

    $start = 0;
    $limit = 25;

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

    return json_encode($products);
});

WHMCS Docs

http://docs.whmcs.com/API