zoparga/easybill

Laravel 包,用于使用 easybill.de REST API

安装: 21

依赖: 0

建议者: 0

安全: 0

星标: 0

关注者: 2

分支: 0

开放问题: 0

类型:package

v1.0.4 2022-03-02 15:01 UTC

This package is auto-updated.

Last update: 2024-08-29 05:44:33 UTC


README

Latest Stable Version Total Downloads StyleCI License

非官方 Laravel 包,用于使用 easybill.de REST API

此 Laravel 包是一个非常基础且未经测试的版本!

安装

composer require zoparga/easybill

Laravel 5.5+

无需注册任何提供者/别名。感谢 Laravel 包发现

Laravel 5.4

config/app.php 中添加 ServiceProvider 和 Facade

'providers' => [
    ...
    zoparga\EasyBill\EasybillServiceProvider::class,
];

'aliases' => [
    ...
    'EasyBill' => zoparga\EasyBill\Facade\EasyBill::class,
];

配置

将您的 easybill.de API 密钥添加到您的 .env

EASYBILL_API_KEY=xxxxxx

使用

我只实现了某些基本的 API 调用

// 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();


$pdf = EasyBill::getPDF($pdfID);
$resultPdf = $pdf->getBody();

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

贡献

如果您发现任何问题,或有更好的实现方式,请随时提交问题或拉取请求。