2017 © Pedro PelĂĄez
 

library billogram

Library for connecting to the Billogram v2 API

image

friendsofapi/billogram

Library for connecting to the Billogram v2 API

  • Thursday, February 1, 2018
  • by Nyholm
  • Repository
  • 3 Watchers
  • 0 Stars
  • 260 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 12 Forks
  • 3 Open issues
  • 9 Versions
  • 0 % Grown

The README.md

Billogram v2 API Client

Latest Version Software License Build Status Code Coverage Quality Score Total Downloads, (*1)

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"., (*2)

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., (*3)

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., (*4)

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., (*5)

$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:, (*6)

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., (*7)

Contribute

Do you want to make a change? Pull requests are welcome., (*8)

The Versions

02/02 2016

1.12.1

1.12.1.0 https://billogram.com/api/documentation

Library for connecting to the Billogram v2 API

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

api

14/01 2015

v1.12

1.12.0.0 https://billogram.com/api/documentation

Library for connecting to the Billogram v2 API

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

api

18/02 2014

v1.11

1.11.0.0 https://billogram.com/api/documentation

Library for connecting to the Billogram v2 API

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

api

06/02 2014

v1.1

1.1.0.0 https://billogram.com/api/documentation

Library for connecting to the Billogram v2 API

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

api

06/11 2013

v1.01

1.01.0.0 https://billogram.com/api/documentation

Library for connecting to the Billogram v2 API

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

api

31/10 2013

v1.0

1.0.0.0 https://billogram.com/api/documentation

Library for connecting to the Billogram v2 API

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

api