rene-roscher/easybill

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

安装: 38

依赖者: 0

建议者: 0

安全: 0

星星: 0

关注者: 0

分支: 3

类型:

v1.0 2023-08-20 07:50 UTC

This package is not auto-updated.

Last update: 2024-09-16 11:03:59 UTC


README

Latest Stable Version Total Downloads StyleCI License

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

这个 Laravel 包是一个非常基础且未经验证的版本!

安装

composer require divdax/easybill

Laravel 5.5+

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

Laravel 5.4

config/app.php 中添加 ServiceProvider 和 Facade

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

'aliases' => [
    ...
    'Easybill' => DivDax\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();

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

贡献

如果您发现了一个问题,或者有更好的实现方式,请随时提交 issue 或 pull request。