zoparga / easybill
Laravel 包,用于使用 easybill.de REST API
v1.0.4
2022-03-02 15:01 UTC
Requires
- guzzlehttp/guzzle: ^6.2|^7.0
- illuminate/contracts: ^8.73
- illuminate/support: ~5.5.0|~5.6.0|~5.7.0|~5.8.0|^6.0|^7.0|^8.0
- spatie/laravel-package-tools: ^1.9.2
Requires (Dev)
- nunomaduro/collision: ^5.10
- orchestra/testbench: ^6.22
- pestphp/pest: ^1.21
- pestphp/pest-plugin-laravel: ^1.1
- phpunit/phpunit: ^9.5
- spatie/laravel-ray: ^1.26
README
非官方 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']);
贡献
如果您发现任何问题,或有更好的实现方式,请随时提交问题或拉取请求。