Skip to content

About

Modern, typed PHP 8.4+ SDK for the Billomat API — `final readonly` models, typed create/update options, Symfony HttpClient under the hood, full exception hierarchy, PHPStan level max.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

258 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Billomat PHP SDK

CI Packagist Version Downloads PHP PHPStan Mutation testing License

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.

Installation

composer require justpilot/billomat-php-api

Coming 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/guzzle

Requirements: PHP 8.5+, ext-bcmath, a Billomat account with API access and an API key from https://<billomatId>.billomat.net/app/settings/api.

Quickstart

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 % VAT

More runnable scripts in examples/.

Features

  • Typed end to end: final readonly models, enums for every fixed value set, exact Money amounts instead of float, DateTimeImmutable dates. Fields the SDK doesn't know yet are kept in $extra.
  • Immutable write options with named arguments and with*() withers; Clear::Field empties a field on update.
  • Typed list filters (InvoiceFilter, ClientFilter, …) with OrderBy, plus iterateAll() auto-pagination and listPage() 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 with isTransient() and mayHaveBeenProcessed().
  • Observable: optional PSR-3 logging (never headers or bodies) and PSR-14 events per request, retry and failure.
  • Webhooks: WebhookEvent (all 83 events), WebhookHeaders and WebhookPayload parse incoming requests into the matching model.
  • Quality: PHPStan level max, ~4,500 unit tests, mutation testing (Infection) and integration tests against the Billomat sandbox.

Documentation

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.

Supported versions

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

Contributing

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).

License

Apache License 2.0, see LICENSE.

About

Modern, typed PHP 8.4+ SDK for the Billomat API — `final readonly` models, typed create/update options, Symfony HttpClient under the hood, full exception hierarchy, PHPStan level max.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages