承接 friendsofapi/billogram 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

friendsofapi/billogram

最新稳定版本:2.0.0-alpha2

Composer 安装命令:

composer require friendsofapi/billogram

包简介

Library for connecting to the Billogram v2 API

关键字:

README 文档

README

Latest Version Software License Build Status Code Coverage Quality Score Total Downloads

This Billogram fork was created to because we wanted to have a modern API client that followed PHP standards. Attempts were made to improve the original library but they were quickly shutdown. This fork will live "forever".

Installation:

composer require friendsofapi/billogram php-http/guzzle6-adapter php-http/message

Why php-http/guzzle6-adapter php-http/message? We are decoupled from any HTTP messaging client with help by HTTPlug. Read about clients in the HTTPlug docs.

Usage

First you need to register an account. it's recommend that you sign up on Billogram sandbox environment Sandbox Billogram or on Billogram, then generate an API user.

Authentication:

After you have generated an API user you need to create a BillogramClient and pass your user and the password to the factory function.

$billogram = BillogramClient::create($username, $apikey);
Create a customer:
use Billogram\Model\Customer\CustomerContact;
use Billogram\Model\Customer\CustomerBillingAddress;
use Billogram\Model\Customer\CustomerDeliveryAddress;
use Billogram\Model\Customer\Customer;

$contact = CustomerContact::createFromArray(['name' => 'ib92g', 'email' => 'ib922@gmail.com', 'phone' => '0712223344']);
$addressCustomer = CustomerBillingAddress::createFromArray(['careof' => 'ibrahim', 'use_careof_as_attention' => false, 'street_address' => 'Flygarvägen 189B', 'zipcode' => '175 69', 'city' => 'Järfälla', 'country' => 'SE']);
$addressDelivery = CustomerDeliveryAddress::createFromArray(['name' => 'ibrahim', 'street_address' => 'Flygarvägen 189B', 'careof' => 'ibrahim', 'zipcode' => '175 69', 'city' => 'Järfälla', 'country' => 'SE']);

$customer = new Customer();
$customer = $customer->withCustomerNo(1);
$customer = $customer->withName('Ibrahim AA');
$customer = $customer->withNotes('aa');
$customer = $customer->withOrgNo('556801-7155');
$customer = $customer->withVatNo('SE556677889901');
$customer = $customer->withContact($contact);
$customer = $customer->withAddress($addressCustomer);
$customer = $customer->withDeliveryAddress($addressDelivery);
$customer = $customer->withCompanyType('individual');

$customer = $billogram->customers()->create($customer->toArray());
Fetch a customer:
$customer = $billogram->customers()->fetch($customerNo);    
Create an item:
use Billogram\Model\Item\Bookkeeping;
use Billogram\Model\Item\Item;

$bookkeeping = Bookkeeping::createFromArray(['income_account' => '302', 'vat_account' => '303']);
$item = new Item();
$item = $item->withTitle('cc');
$item = $item->withDescription('cc');
$item = $item->withPrice(12);
$item = $item->withVat(12);
$item = $item->withUnit('hour');
$item = $item->withBookkeeping($bookkeeping);

$item = $billogram->items()->create($item->toArray());
Fetch items:
$items = $billogram->items()->search(['page' => 1]);
Delete an item:
$billogram->items()->delete($itemNo);
Create an invoice:

We consider that you have created a customer and an item (See the docs above) and you will you them to create a new invoice:

use Billogram\Model\Invoice\Item;
use Billogram\Model\Invoice\Invoice;

// ...

$itemOfinvoice = new Item();
$itemOfinvoice = $itemOfinvoice->withItemNo($itemFetched->getItemNo());
$itemOfinvoice = $itemOfinvoice->withCount(2)
$itemOfinvoice = $itemOfinvoice->withDiscount(1)

$invoice = new Invoice();
$invoice = $invoice->withCustomer($customer);
$invoice = $invoice->withItems([$itemOfinvoice]);
$invoice = $invoice->withInvoiceDate('2013-11-14');

$invoice = $billogram->invoices()->create($invoice->toArray());

API documentation

The Billogram API documentation is a good place to start if you want to learn more of the API.

Contribute

Do you want to make a change? Pull requests are welcome.

统计信息

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

GitHub 信息

  • Stars: 2
  • Watchers: 3
  • Forks: 13
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-08-27