ufooo / billingo-api-laravel
Billingo API Provider for Laravel 5+
0.1.4
2018-12-24 20:28 UTC
Requires
- php: >=5.5.9
- illuminate/support: 5.*
- voov/billingo-api-connector: 1.*
This package is not auto-updated.
Last update: 2024-09-26 02:11:40 UTC
README
本包是Laravel 5.1+的Billingo API服务提供者和外观。
安装
您必须使用Composer安装库
composer require voov/billingo-api-laravel
在config/app.php
文件中找到providers
数组,并添加Billingo Service Provider
'providers' => [ // ... Billingo\API\Laravel\BillingoServiceProvider::class ];
现在在相同的配置文件中找到aliases
数组,并添加Billingo Facade类
'aliases' => [ // ... 'Billingo' => Billingo\API\Laravel\BillingoFacade::class ];
配置
在您可以使用Billingo服务提供者之前,您需要使用您的API密钥对其进行配置。您可以在以下位置找到API密钥:https://www.billingo.hu/api
在命令行中输入以下内容
php artisan vendor:publish
此命令将在您的配置目录内生成一个billingo.php
文件(通常为config/
)。在此处输入您的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');