andyfraussen/laravel-dokapi-client

A comprehensive, fluent Laravel client for the Dokapi Peppol API with full DTO support and OAuth2 integration

Installs: 1

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/andyfraussen/laravel-dokapi-client

v1.0.0 2026-01-26 18:59 UTC

This package is auto-updated.

Last update: 2026-01-26 19:05:33 UTC


README

Latest Version on Packagist Total Downloads License

A sleek, fluent, and strongly-typed Laravel client for the Dokapi Peppol API. Built for modern PHP 8.5+ and Laravel 12 environments.

Introduction

Dokapi for Laravel provides a high-level, expressive interface for interacting with the Dokapi Peppol infrastructure. It abstracts away the complexities of OAuth2 authentication, token management, and raw API calls, allowing you to focus on building your application.

  • Developer Experience First: A fluent, discoverable API that feels native to Laravel.
  • Type Safety: Extensive use of DTOs ensures your IDE understands every response.
  • Production Ready: Built-in OAuth2 caching, signature verification, and granular error handling.
  • Future Proof: Fully optimized for PHP 8.5 and Laravel 12.

Installation

You may install the package via Composer:

composer require andyfraussen/laravel-dokapi-client

Next, you should publish the configuration file:

php artisan vendor:publish --provider="AndyFraussen\Dokapi\DokapiServiceProvider" --tag="dokapi-config"

Configuration

After publishing the configuration, you may define your Dokapi credentials in your .env file:

DOKAPI_CLIENT_ID=your-client-id
DOKAPI_CLIENT_SECRET=your-client-secret
DOKAPI_BASE_URL=https://peppol-api.dokapi.io/v1

Usage

The Fluent API

The recommended way to interact with Dokapi is through the fluent API provided by the Dokapi facade.

use AndyFraussen\Dokapi\Facades\Dokapi;

// Send a document with a single call
$response = Dokapi::api()->outgoingDocuments->sendDto($payload, $xml);

echo $response->document->ulid;

Outgoing Documents

You can easily send Peppol documents using our expressive request builders:

use AndyFraussen\Dokapi\Dto\ParticipantIdentifier;
use AndyFraussen\Dokapi\Requests\OutgoingDocumentRequest;

$request = new OutgoingDocumentRequest(
    sender: ParticipantIdentifier::of('0208:0123456789'),
    receiver: ParticipantIdentifier::of('0208:9876543210'),
    c1CountryCode: 'BE',
    documentTypeIdentifier: $docType,
    processIdentifier: $process,
    externalReference: 'inv-2026-001'
);

$response = Dokapi::sendOutgoingDocument($request, $xml);

Webhook Signature Verification

Security is paramount. Verify incoming webhooks with ease:

use AndyFraussen\Dokapi\Facades\Dokapi;

$isValid = Dokapi::webhooks()->verifySignature(
    payload: $request->getContent(),
    signature: $request->header('X-Dokapi-Signature'),
    secret: config('dokapi.webhook_secret')
);

Testing

composer test

Static Analysis

We maintain a high standard of code quality using Larastan (PHPStan):

composer phpstan

Contributing

Please see CONTRIBUTING for details.

License

The MIT License (MIT). Please see License File for more information.