Skip to content

Ibrahimhizeoui/billogram-v2-api-php-lib

 
 

Repository files navigation

Billogram v2 API Client

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

The Billogram API is built according to RESTful principles, which means it uses HTTP as an application protocol. This library available for PHP. It have code examples which are easy to use but we recommend also to visit the documentation. The following Client Library are central to the use of the Billogram service:

  • Customers
  • Items
  • Invoices
  • Settingd
  • LogoType
  • Report

Installation:

Via Composer

composer require billogram/billogram_api

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

For the authentication :

$httpClientConfigurator = new HttpClientConfigurator(new HttplugClient()); $httpClientConfigurator->setAuth('your Api username', 'your Api password'); $apiClient = BillogramClient::create($httpClientConfigurator);

For example if you need to add a new invoice with a new costumer and a new item :

1- to create the models : *create a new Costumer object (src/Model/Costumer) *create a new Item object (src/Model/Item)

2- to send Http request :

$customercreated = $apiClient->customers()->create($customer);
$itemCreated = $apiClient->items()->create($item);
$itemOfinvoice = new src/Model/Invoice/Item();
$itemOfinvoice = $itemOfinvoice->withItemNo($itemCreated->getItemNo());
$itemOfinvoice = $itemOfinvoice->withCount(2)
$itemOfinvoice = $itemOfinvoice->withDiscount(1)
$invoice = new src/Model/Invoice/Invoice();
$invoice = $invoice->withCustomer($customer);
$invoice = $invoice->withItems([$itemOfinvoice]);
$invoice = $invoice->withInvoiceDate('2013-11-14');
$cacheClient = $this->getHttpClient();
$invoiceCreated = $apiClient->invoices()->create($invoice);

Examples

This repository contains an example API client for FakeTwitter. The API for FakeTwitter has the following endpoints.

Method URI Parameters
GET api/v2/customer (array) param
GET api/v2/customer/{id} (array) param
POST api/v2/customer (Customer) customer
PUT api/v2/customer/{id} (Customer) customer
GET api/v2/item (array) param
GET api/v2/item/{id} (array) param
POST api/v2/item (Item) item
PUT api/v2/item/{id} (Item) item
Delete api/v2/item/{id}
GET api/v2/item (array) param
GET api/v2/item/{id} (array) param
POST api/v2/item (Item) item
PUT api/v2/item/{id} (Item) item
Delete api/v2/item/{id}
GET api/v2/settings
PUT api/v2/settings (Item) item
GET api/v2/logotype
POST api/v2/logotype (Item) item
GET api/v2/report (array) param
GET api/v2/report/{filename}

Documentation

Read the Billogram documentation

Contribute

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

About

PHP library for the Billogram REST API

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%