fiterik/billingo-api-laravel

Billingo API Provider for Laravel 5+

0.1.2 2016-02-23 21:20 UTC

This package is not auto-updated.

Last update: 2019-09-15 13:33:16 UTC


README

本包是Laravel 5.1+的Billingo API服务提供者和外观。

安装

您必须使用Composer安装此库

composer require voov/billingo-api-laravel

config/app.php文件中的providers数组中找到并添加Billingo服务提供者

'providers' => [
  // ...
  Billingo\API\Laravel\BillingoServiceProvider::class
];

现在在相同的配置文件中找到aliases数组并添加Billingo外观类

'aliases' => [
  // ...
  'Billingo' => Billingo\API\Laravel\BillingoFacade::class
];

配置

在使用Billingo服务提供者之前,您需要使用您的API密钥进行配置。您可以在以下位置找到API密钥: https://www.billingo.hu/api

在命令行中输入以下内容

php artisan vendor:publish

此命令将在您的配置目录(通常是config/)内生成一个billingo.php文件。在此处输入您的API凭证。

使用方法

获取资源

// Return the list of clients
$clients = Billingo::get('clients');

// Return one client
$client = Billingo::get('clients/123456789');

保存资源

// save a new client
$clientData = [
  "name" => "Gigazoom LLC.",
  "email" => "rbrooks5@amazon.com",
  "billing_address" => [
      "street_name" => "Moulton",
      "street_type" => "Terrace",
      "house_nr" => "2797",
      "city" => "Preston",
      "postcode" => "PR1",
      "country" => "United Kingdom"
  ]
]
Billingo::post('clients', $clientData);

更新资源

// save client
Billingo::put('clients/123456789', $newData);

删除资源

// delete client
Billingo::delete('clients/123456789');