nihilsen/laravel-boxbilling 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

nihilsen/laravel-boxbilling

最新稳定版本:v0.2.1

Composer 安装命令:

composer require nihilsen/laravel-boxbilling

包简介

A BoxBilling API bridge for Laravel.

README 文档

README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

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.

Installation

You can install the package via composer:

composer require nihilsen/laravel-boxbilling

If 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'

Usage

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

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();

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 2
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-10-11