divdax / easybill by DivDax

Laravel Package to use the easybill.de REST API
895
3
3
Package Data
Maintainer Username: DivDax
Maintainer Contact: divdax@gmail.com (Heiko Klingele)
Package Create Date: 2017-05-11
Package Last Update: 2022-09-05
Home Page:
Language: PHP
License: MIT
Last Refreshed: 2024-04-19 15:05:34
Package Statistics
Total Downloads: 895
Monthly Downloads: 7
Daily Downloads: 0
Total Stars: 3
Total Watchers: 3
Total Forks: 3
Total Open Issues: 0

easybill.de REST API v1

Unofficial Laravel Package to use the easybill.de REST API.

This Laravel Package is a very basic and untested version!

Installation

composer require divdax/easybill

Laravel 5.5, 5.6

No need to register any providers / aliases. Thanks to Laravels Package Discovery.

Laravel 5.4

Add the ServiceProvider and Facade in config/app.php

'providers' => [
    ...
    DivDax\Easybill\EasybillServiceProvider::class,
];

'aliases' => [
    ...
    'Easybill' => DivDax\Easybill\Facade\Easybill::class,
];

Configuration

Add your easybill.de api key to your .env

EASYBILL_API_KEY=xxxxxx

Usage

I only implemented some basic api calls

// Search Customer with exact match
Easybill::searchCustomer([
    'company_name' => 'Company Name'
]);

// Create Customer
$customer = Easybill::createCustomer([
    'company_name' => 'Musterfirma GmbH',
    'first_name' => 'Max',
    'last_name' => 'Muster',
    'street' => 'Musterstr. 123',
    'zipcode' => '12345',
    'city' => 'Musterstadt',
    'emails' => ['mail@example.com'],
]);

// Delete Customer
Easybill::deleteCustomer($customer->id);

// Create Document (Invoice)
$doc = Easybill::createDocument([
    'type' => 'INVOICE',
    'title' => 'Titel',
    //'customer_id' => 0,
    'text_prefix' => 'Hello',
    'text' => 'Bye',
    'items' => [
        [
            'type' => 'POSITION',
            'number' => '123', // article number
            'description' => 'Positionsbeschreibung 1',
            'quantity' => 1,
            'single_price_net' => 10 * 100, // cent
            'vat_percent' => 19
        ],
        [
            'type' => 'TEXT',
            'description' => 'Text only',
        ],
        [
            'type' => 'POSITION',
            'description' => 'Positionsbeschreibung 3',
            'quantity' => 1,
            'single_price_net' => 20 * 100,
            'vat_percent' => 19
        ],
    ],
]);

// Finish Document (set auto created document number)
$doc->done();

// Update Document
Easybill::updateDocument($id, ['status' => 'DONE']);

Contributing

If you find an issue, or have a better way to do something, feel free to open an issue or a pull request.