gitlabEdit

๐Ÿ˜PHP SDK

Official PHP client library for the Docs-Dispatcher API. Build document generation, email dispatch, SMS, invoicing, and e-signature workflows in modern PHP applications.

Pipeline Statusarrow-up-right Coverage Reportarrow-up-right

Requirements

  • PHP: 8.1 or higher

  • Composer: 2.0+

Versions

SDK Version
PHP Version
Branch
circle-exclamation

Installation

Install via Composer:

composer require docs-dispatcher.io/sdk

Core Concepts

Understanding these concepts will help you use the SDK effectively:

Authentication

Two authentication methods are supported:

Bearer Token (JWT) - Recommended:

Basic Auth:

circle-info

Get Your API Token: Log in to the Docs-Dispatcher dashboardarrow-up-right and navigate to Settings โ†’ API Tokens to generate a new token.

Service

A service represents an API endpoint with its own parameters. Each service corresponds to a Docs-Dispatcher capability:

  • EmailService: Send emails with attachments

  • FileService: Generate documents from templates

  • SmsService: Send SMS messages

  • PostalService: Send postal mail

  • ESignService: Handle electronic signatures

  • UploadService: Upload files to external services

  • InvoicingService: Create invoices, quotes, or credit notes

For detailed service parameters, see the API documentationarrow-up-right or Swagger formatarrow-up-right.

ServiceMediator

The ServiceMediator class manages your defined services and their configurations. It temporarily stores services before building the API request.

Client

The Client class triggers API calls. It decorates a GuzzleHttp\Client instance and handles HTTP communication:

Quick Start

Basic Setup

Service Examples

Email Service

Send templated emails with dynamic content:

Common Use Cases:

  • Welcome emails

  • Password reset notifications

  • Order confirmations

  • Invoice delivery

File Service

Generate documents from templates in various formats:

Supported Formats:

  • PDF

  • DOCX (Microsoft Word)

  • XLSX (Microsoft Excel)

  • HTML

  • PNG/JPG/SVG images

See Template Managementarrow-up-right for template creation.

SMS Service

Send SMS messages via configured providers:

Supported Providers:

Postal Service

Send physical mail via postal services:

E-Signature Service

Request electronic signatures:

Signature Types:

  • SIMPLE: Basic electronic signature

  • ADVANCED: Identity-verified signature

  • QUALIFIED: Legally binding qualified signature (eIDAS compliant)

See E-Signature Providersarrow-up-right for provider configuration.

Invoicing Service

Create invoices, quotes, or credit notes with full customization.

Complete Invoicing Example

Customer Types

The SDK supports three customer types for different business scenarios:

Company Customer

For B2B transactions with businesses:

Required Fields:

  • Company name (setName())

  • Registration number (setRegistrationNumber())

  • VAT number (setVatNumber())

  • Email

  • Billing address

Individual Customer

For B2C transactions with consumers:

Required Fields:

  • First name (setFirstname())

  • Last name (setLastname())

  • Email

  • Billing address

Freelance Customer

For transactions with freelancers/self-employed:

Required Fields:

  • First name (setFirstname())

  • Last name (setLastname())

  • Email

  • Billing address

  • Business name (optional)

  • Registration number (optional)

  • VAT number (optional)

Document Types

Choose the appropriate document type:

Discount Types

Apply discounts at item or invoice level:

Invoice Providers

iPaidThat (French invoicing platform):

Qonto (European business banking):

Stripe (Payment processing with invoicing):

See Invoice Providersarrow-up-right for configuration details.

Service Composition

Chain multiple services in a single API call:

Error Handling

The SDK uses standard PHP exceptions for error handling:

See Troubleshooting for common errors and solutions.

Available Services

Service
Class
Description

Email

EmailService

Send emails with attachments

File

FileService

Generate documents from templates

SMS

SmsService

Send SMS messages

Postal

PostalService

Send postal mail

E-Sign

ESignService

Handle electronic signatures

Upload

UploadService

Upload files to external services

Invoicing

InvoicingService

Create invoices, quotes, credit notes

Advanced Usage

Custom Base URL

Override the default API endpoint:

Custom HTTP Client

Provide your own Guzzle client instance:

Environment-Specific Configuration

Example File

A complete usage example is available in the SDK repository:

Documentation

Repository

Framework Integration

Laravel

Symfony

Next Steps

Configure Providers

Troubleshoot Issues

Support

Last updated