PHPackages                             tombroucke/zenfactuur-php-client - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. tombroucke/zenfactuur-php-client

ActiveLibrary[API Development](/categories/api)

tombroucke/zenfactuur-php-client
================================

Consume the Zenfactuur API

166PHP

Since Oct 3Pushed 7mo agoCompare

[ Source](https://github.com/tombroucke/zenfactuur-php-client)[ Packagist](https://packagist.org/packages/tombroucke/zenfactuur-php-client)[ RSS](/packages/tombroucke-zenfactuur-php-client/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Zenfactuur PHP Client
=====================

[](#zenfactuur-php-client)

A PHP client library for consuming the Zenfactuur API. This library provides a simple and intuitive way to interact with Zenfactuur's invoicing and client management features.

Installation
------------

[](#installation)

Install the package via Composer:

```
composer require tombroucke/zenfactuur-php-client
```

Basic Usage
-----------

[](#basic-usage)

### Creating a Connector

[](#creating-a-connector)

```
use Otomaties\Zenfactuur\ZenfactuurConnector;

$connector = new ZenfactuurConnector(
    token: 'your-api-token'
);
```

### API Token Validation

[](#api-token-validation)

Verify your API token and get account information:

```
use Otomaties\Zenfactuur\GetApiTokenRequest;

$request = new GetApiTokenRequest();
$response = $connector->send($request);

if ($response->successful()) {
    $data = $response->data();
    echo "Username: " . $data['username'];
}
```

Client Management
-----------------

[](#client-management)

### Get All Clients

[](#get-all-clients)

```
use Otomaties\Zenfactuur\Clients\GetClientsRequest;

// Get first page
$request = new GetClientsRequest();
$response = $connector->send($request);

// Get specific page
$requestPage2 = new GetClientsRequest();
$requestPage2->page(2);
$responsePage2 = $connector->send($requestPage2);
```

### Create a Client

[](#create-a-client)

```
use Otomaties\Zenfactuur\Clients\CreateClientRequest;

$request = new CreateClientRequest([
    'type_id' => 0,
    'name' => 'John Doe',
    'email' => 'john@example.com',
]);

$response = $connector->send($request);

if ($response->status() === 201) {
    $client = $response->data();
    echo "Created client with ID: " . $client['id'];
}
```

### Find Clients

[](#find-clients)

Search for clients by name or other criteria:

```
use Otomaties\Zenfactuur\Clients\FindClientsRequest;

$request = new FindClientsRequest(query: 'John Doe');
$response = $connector->send($request);

$clients = $response->data();
```

### Update a Client

[](#update-a-client)

```
use Otomaties\Zenfactuur\Clients\UpdateClientRequest;

$clientId = 123;
$updateData = [
    'name' => 'John Smith',
    'email' => 'johnsmith@example.com',
];

$request = new UpdateClientRequest($clientId, $updateData);
$response = $connector->send($request);
```

### Get Single Client

[](#get-single-client)

```
use Otomaties\Zenfactuur\Clients\GetClientRequest;

$request = new GetClientRequest($clientId);
$response = $connector->send($request);
```

Invoice Management
------------------

[](#invoice-management)

### Get All Invoices

[](#get-all-invoices)

```
use Otomaties\Zenfactuur\Invoices\GetInvoicesRequest;

$request = new GetInvoicesRequest();
$response = $connector->send($request);

$invoices = $response->data();
```

### Get Unpaid Invoices

[](#get-unpaid-invoices)

```
use Otomaties\Zenfactuur\Invoices\GetUnpaidInvoicesRequest;

$request = new GetUnpaidInvoicesRequest();
$response = $connector->send($request);
```

### Create an Invoice

[](#create-an-invoice)

```
use Otomaties\Zenfactuur\Invoices\CreateInvoiceRequest;

$request = new CreateInvoiceRequest([
    'client' => [
        'type_id' => 0,
        'name' => 'John Doe',
        'email' => 'john@example.com',
        'street' => 'Main Street 123',
        'postcode' => '12345',
        'city' => 'Brussels',
        'country' => 'BE',
    ],
    'invoice' => [
        'date' => date('Y-m-d'),
        'internal_description' => 'Invoice for services',
        'vat_percentage' => 21,
        'pay_message' => true,
        'commercial_document_lines_attributes' => [
            [
                'description' => 'Web Development Services',
                'unit_price' => 75.00,
                'number_skus' => 10, // quantity
            ],
            [
                'description' => 'Hosting Services',
                'unit_price' => 25.00,
                'number_skus' => 1,
            ],
        ],
    ],
]);

$response = $connector->send($request);

if ($response->status() === 201) {
    $invoice = $response->data();
    echo "Created invoice with ID: " . $invoice['id'];
}
```

### Get Single Invoice

[](#get-single-invoice)

```
use Otomaties\Zenfactuur\Invoices\GetInvoiceRequest;

$invoiceId = 123456;
$request = new GetInvoiceRequest($invoiceId);
$response = $connector->send($request);

$invoice = $response->data();
```

### Send Invoice by Email

[](#send-invoice-by-email)

Send an invoice to a recipient via email with optional attachments and customization:

```
use Otomaties\Zenfactuur\Invoices\SendByEmailRequest;

$invoiceId = 123456;
$recipientEmail = 'client@example.com';

$request = new SendByEmailRequest($invoiceId, $recipientEmail);

// Optional: Add CC recipients
$request->cc('manager@example.com');

// Optional: Add BCC recipients
$request->bcc('accounting@example.com');

// Optional: Customize subject
$request->subject('Your Invoice from Company Name');

// Optional: Add custom email content
$request->content('Dear Client, please find your invoice attached. Thank you for your business!');

// Optional: Attach PDF version (default: true)
$request->attachPdf(true);

// Optional: Attach XML version (default: false)
$request->attachXml(true);

// Optional: Send reminder notification (default: false)
$request->sendReminder(true);

$response = $connector->send($request);

if ($response->successful()) {
    echo "Invoice sent successfully!";
}
```

#### Basic Email Send

[](#basic-email-send)

For a simple email send with default settings:

```
use Otomaties\Zenfactuur\Invoices\SendByEmailRequest;

$request = new SendByEmailRequest(123456, 'client@example.com');
$response = $connector->send($request);
```

### Send Invoice to Peppol

[](#send-invoice-to-peppol)

Send an invoice via the Peppol network for B2B electronic invoicing:

```
use Otomaties\Zenfactuur\Invoices\SendToPeppolRequest;

$invoiceId = 123456;
$request = new SendToPeppolRequest($invoiceId);
$response = $connector->send($request);

if ($response->successful()) {
    echo "Invoice sent to Peppol network successfully!";
    $data = $response->data();
    // Handle response data as needed
}
```

**Note:** Peppol sending requires:

- The client to have a valid Peppol participant ID
- The invoice to be in a valid format for Peppol transmission
- Your Zenfactuur account to have Peppol integration enabled

Pagination
----------

[](#pagination)

For endpoints that support pagination (like `GetClientsRequest`), you can specify the page:

```
$request = new GetClientsRequest();
$request->page(2); // Get page 2
```

Testing
-------

[](#testing)

Run the test suite:

```
composer test
```

The package includes comprehensive tests for all API endpoints. Make sure to set your `ZENFACTUUR_TOKEN` in a `.env` file before running tests.

Requirements
------------

[](#requirements)

- PHP 8.0 or higher
- Guzzle HTTP client
- Fansipan HTTP client library

License
-------

[](#license)

This package is open-sourced software licensed under the MIT license.

Contributing
------------

[](#contributing)

Contributions are welcome! Please feel free to submit a Pull Request.

---

For more information about the Zenfactuur API, please refer to their official documentation.

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance45

Moderate activity, may be stable

Popularity10

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity13

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/4178291ccf36e3530aa8a8845124c3af1b24c064739ad98ded5b9679a4316033?d=identicon)[tombroucke](/maintainers/tombroucke)

---

Top Contributors

[![tombroucke](https://avatars.githubusercontent.com/u/24292260?v=4)](https://github.com/tombroucke "tombroucke (6 commits)")

### Embed Badge

![Health badge](/badges/tombroucke-zenfactuur-php-client/health.svg)

```
[![Health](https://phpackages.com/badges/tombroucke-zenfactuur-php-client/health.svg)](https://phpackages.com/packages/tombroucke-zenfactuur-php-client)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M454](/packages/google-gax)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
