This package adds a simple interface for interacting with the API of a BoxBilling instance.
Basic authentication via a token is supported for Client and Admin endpoints.
You can install the package via composer:
composer require nihilsen/laravel-boxbillingIf you wish, you may publish the config file with:
php artisan vendor:publish --tag="laravel-boxbilling-config"In the published config file, you may configure the url for the BoxBilling instance as well as the token for authenticated requests:
return [
    /*
    |--------------------------------------------------------------------------
    | Url
    |--------------------------------------------------------------------------
    |
    | The base url for all BoxBilling API requests.
    |
    */
    'url' => env('BOXBILLING_API_URL'),
    /*
    |--------------------------------------------------------------------------
    | Token
    |--------------------------------------------------------------------------
    |
    | The authentication token for authenticated API requests.
    |
    */
    'token' => env('BOXBILLING_API_TOKEN'),
];Alternatively, you may configure these options via your .env enviroment file:
BOXBILLING_API_URL='https://boxbilling.tld/api'
BOXBILLING_API_TOKEN='your_secret_boxbilling_token'
API calls follow a format similar to that used internally in BoxBilling.
The starting point should always be the BoxBilling facade.
Request parameters MUST be passed as named parameters.
use Nihilsen\BoxBilling\Facades\BoxBilling;
# Determine BoxBilling version (endpoint: guest/system/version)
$version = BoxBilling::guest()->system_version();
# Get client by id (endpoint: admin/client/get)
$client = BoxBilling::admin()->client_get(id: 42);
# Get profile of client by id (endpoint: client/profile/get)
$profile = BoxBilling::client(id: 42)->profile_get();Paginated results are collected into a Nihilsen\BoxBilling\Collection instance, which is subclass of Illuminate\Support\LazyCollection.
use Nihilsen\BoxBilling\Facades\BoxBilling;
/** @var Nihilsen\BoxBilling\Collection **/
$tickets = BoxBilling::admin()->support_ticket_get_list(page: 1, per_page: 10);
# Select a random ticket 
$ticket = $tickets->random();composer testPlease see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
The MIT License (MIT). Please see License File for more information.