A modern, fully typed PHP 8.5 SDK for the Billomat API: invoices, offers, clients, payments, PDFs and incoming webhooks, on top of any PSR-18 HTTP client.
Unofficial. This project is not affiliated with Billomat GmbH.
Deutsch: Die Dokumentation ist auf Englisch; Code-Kommentare und Docblocks im SDK sind deutsch. Fragen gern auch auf Deutsch in den Issues.
composer require justpilot/billomat-php-apiComing from 3.x? UPGRADE-4.0.md lists every change and ships a Rector set for the mechanical part.
The SDK needs a PSR-18 client and PSR-17 factories. If you allow the php-http/discovery Composer plugin, it installs one when none is present; otherwise pick one:
composer require symfony/http-client nyholm/psr7 # or: composer require guzzlehttp/guzzleRequirements: PHP 8.5+, ext-bcmath, a Billomat account with API access and an API key from https://<billomatId>.billomat.net/app/settings/api.
use Justpilot\Billomat\Api\InvoiceCreateOptions;
use Justpilot\Billomat\Api\InvoiceItemCreateOptions;
use Justpilot\Billomat\BillomatClient;
use Justpilot\Billomat\Model\Money;
$billomat = BillomatClient::create(
billomatId: 'mycompany',
apiKey: getenv('BILLOMAT_API_KEY') ?: throw new RuntimeException('BILLOMAT_API_KEY is not set'),
);
$invoice = $billomat->invoices->create(new InvoiceCreateOptions(
clientId: 12345,
title: 'Web development May 2026',
items: [new InvoiceItemCreateOptions(quantity: 8.0, unitPrice: Money::of('95.00'), title: 'Concept')],
));
$billomat->invoices->complete($invoice->id); // assigns the number
$pdf = $billomat->invoices->pdfContent($invoice->id);
file_put_contents("invoice-{$invoice->id}.pdf", $pdf);
echo $billomat->invoices->getOrFail($invoice->id)->totalGross?->format(2, ',', '.'); // "904,40" with 19 % VATMore runnable scripts in examples/.
- Typed end to end:
final readonlymodels, enums for every fixed value set, exactMoneyamounts instead offloat,DateTimeImmutabledates. Fields the SDK doesn't know yet are kept in$extra. - Immutable write options with named arguments and
with*()withers;Clear::Fieldempties a field on update. - Typed list filters (
InvoiceFilter,ClientFilter, …) withOrderBy, plusiterateAll()auto-pagination andlistPage()metadata. - Nested sub-resources:
$billomat->invoices->items,->payments,->comments,->tags, … - Any PSR-18 client (Symfony, Guzzle, …); runtime dependencies are PSR interfaces only (plus
php-http/discovery). - Resilient: automatic retries for 429 (honouring
Retry-After) and, for GET, 502/503/504 and network errors; errors are classified withisTransient()andmayHaveBeenProcessed(). - Observable: optional PSR-3 logging (never headers or bodies) and PSR-14 events per request, retry and failure.
- Webhooks:
WebhookEvent(all 83 events),WebhookHeadersandWebhookPayloadparse incoming requests into the matching model. - Quality: PHPStan level max, ~4,500 unit tests, mutation testing (Infection) and integration tests against the Billomat sandbox.
| Topic | |
|---|---|
| Configuration, HTTP client, logging and events | docs/configuration.md |
| Errors, retries and rate limits | docs/error-handling.md, docs/concepts/errors-and-rate-limits.md |
| Pagination and filters | docs/advanced/pagination.md |
| Read models, money, webhooks | docs/concepts/models.md, money.md, webhooks.md |
| Resources (invoices, offers, clients, …) | docs/resources/ |
| Testing your integration | docs/testing.md |
| Upgrading from 3.x | UPGRADE-4.0.md, with a Rector set for the mechanical changes |
Coming from phobetor/billomat |
docs/migration-from-phobetor.md |
The full documentation is also published at billomat-php.justpilot.io.
| SDK | PHP | HTTP client | Status |
|---|---|---|---|
| 4.x | 8.5+ | any PSR-18 client | active |
| 3.x | 8.4+ | Symfony HttpClient 8.1+ | security fixes until 2027-05-31 |
Pull requests are welcome; please read CONTRIBUTING.md first. AI coding agents find the project conventions in AGENTS.md. Security issues: see SECURITY.md. Changes are listed in CHANGELOG.md (Keep a Changelog, Semantic Versioning).
Apache License 2.0, see LICENSE.