2017 © Pedro Peláez
 

library billy-php-sdk

PHP-SDK to communicate with Billy (http://www.billy.dk)

image

lsolesen/billy-php-sdk

PHP-SDK to communicate with Billy (http://www.billy.dk)

  • Monday, July 24, 2017
  • by lsolesen
  • Repository
  • 3 Watchers
  • 3 Stars
  • 1,128 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 3 Versions
  • 39 % Grown

The README.md

Billy PHP SDK

Build Status Code Coverage Scrutinizer Code Quality Latest Stable Version Total Downloads License, (*1)

PHP SDK for Billy API version 2 only from the Danish accounting program Billy., (*2)

Getting started

Before doing anything you should register yourself with Billy and get access credentials., (*3)

Installation

Composer

Simply add a dependency on lsolesen/billy-php-sdk to your project's composer.json file if you use Composer to manage the dependencies of your project. Here is a minimal example of a composer.json file that just defines a dependency on Billy PHP SDK 2.1:, (*4)

{
    "require": {
        "lsolesen/billy-php-sdk": "2.1.*"
    }
}

After running composer install, you can take advantage of Composer's autoloader in vendor/autoload.php., (*5)

Usage

Create a new client

First you should create a client instance that is authorized with api_key or provided by Billy., (*6)


Create and update contact

 $name,
            'email' => $email,
        )
    );
    $contact = new Contact();
    $contact
        ->setName($name)
        ->set('phone', $phone)
        ->setCountryID($address['country'])
        ->set('street', $address['thoroughfare'])
        ->set('cityText', $address['locality'])
        ->set('stateText', $address['administrative_area'])
        ->set('zipcodeText', $address['postal_code'])
        ->set('contactNo', $profile_id)
        ->set('contactPersons', $persons);

    $repository = new ContactRepository($request);
    $created_contact = $repository->create($contact);

    $contact = $repository->getSingle($created_contact->getID());
    $contact
        ->setName($new_name);
    $repository->update($contact);
} catch (Exception $e) {
    //...
}
?>

Create and update product

 'DKK',
        'unitPrice' => '20.25',
    );
    $product = new Product();
    $product
        ->setAccount($billy_state_account_id)
        ->setProductNo($product_id)
        ->setSalesTaxRuleset($billy_vat_model_id)
        ->set('prices', $prices);

    $repository = new ProductRepository($request);
    $created_product = $repository->create($product);

    $product = $repository->getSingle($created_product->getID());
    $product
        ->setName($new_name);
    $repository->update($product);
} catch (Exception $e) {
    //...
}
?>

Create an invoice

setProductID($product->getID())
        ->setQuantity(4)
        ->set('priority', $priority)
        ->setDescription('My description')
        ->setUnitPrice(20.25);

    $invoice_line_items[] = $invoice_line->toArray();

    $new_invoice = new Billy_Invoice();
    $new_invoice->setType('invoice')
        ->setOrderNumber($order_number)
        ->setContactID($contact->getID())
        ->setContactMessage($contact_message)
        ->setEntryDate($entry_date)
        ->setPaymentTermsDays(8)
        ->setCurrencyID('DKK')
        ->set('lines', $invoice_line_items);

    $created_invoice = $repository->create($new_invoice);
    $billy_invoice_id = $created_invoice->getID();
} catch (Exception $e) {
    //...
}
?>

The Versions

24/07 2017

dev-master

9999999-dev http://github.com/lsolesen/billy-php-sdk

PHP-SDK to communicate with Billy (http://www.billy.dk)

  Sources   Download

MIT

The Requires

 

The Development Requires

by Matt Glaman

17/04 2016

2.1.0

2.1.0.0 http://github.com/lsolesen/billy-php-sdk

PHP-SDK to communicate with Billy (http://www.billy.dk)

  Sources   Download

MIT

The Requires

 

The Development Requires

by Matt Glaman

21/03 2016

2.0.0

2.0.0.0 http://github.com/lsolesen/billysbilling

PHP-SDK to communicate with BillysBilling

  Sources   Download

MIT

The Requires

  • php >=5.3.2

 

The Development Requires

by Matt Glaman