laravel-lexware-office maintained by kirchdev
📦 laravel-lexware-office
Lexware Office (formerly lexoffice) API client for Laravel: typed resources, rate limiting, retries, and verified webhooks.
use KirchDev\LexwareOffice\Facades\LexwareOffice;
$invoice = LexwareOffice::invoices()->get($invoiceId);
Read the exact invoice total with $invoice->totalPrice->totalGrossAmount?->value.
📦 Installation
Requires PHP 8.4+ with OpenSSL and Laravel 13.
composer require kirchdev/laravel-lexware-office
Set LEXWARE_OFFICE_API_KEY to the API key for your organization. The package registers its service provider automatically. Create a Lexware API key
🚀 Quick start
Create a customer, then retrieve the contact by the ID in the action result.
use KirchDev\LexwareOffice\Data\{Contact, ContactRole, ContactRoles, Person};
use KirchDev\LexwareOffice\Facades\LexwareOffice;
$contacts = LexwareOffice::contacts();
$result = $contacts->create(new Contact(
roles: new ContactRoles(customer: new ContactRole()),
version: 0,
person: new Person(lastName: 'Musterfrau', firstName: 'Inge'),
));
$customer = $contacts->get($result->id);
foreach ($contacts->list(name: 'Musterfrau', customer: true) as $match) {
echo $match->id, PHP_EOL;
}
✨ Features
- 🧾 Sales documents — Create draft or finalized invoices, quotations and credit notes. Download their PDF or supported e-invoice representation.
- 📎 Files — Upload voucher bytes as multipart data. Read the file ID and voucher ID from the accepted upload.
- 🔢 Exact decimals — Use
new Decimal('19.9900')for amounts, tax rates and quantities. The client writes JSON numbers and preserves their precision when reading. - ⏱️ Shared rate limiting — Workers sharing a cache coordinate requests per API key. The client handles throttling and temporary server failures. Retry and configuration contract
- 📡 Webhooks — Register subscriptions and listen for signed events such as
InvoiceStatusChanged. Webhook setup
⚙️ Configuration
The default gateway is https://api.lexware.io. Set LEXWARE_OFFICE_CACHE_STORE to a shared cache that supports atomic add and increment for all workers using the same API key. To publish the configuration, run php artisan vendor:publish --tag=lexware-office-config. Configuration
🤝 Contributing
Target dev and run the full gate locally. HTTP tests run against shared fixtures and the official signed webhook example. Development setup
🛣️ Versioning
Releases follow Semantic Versioning through release-please. The first release creates the changelog.