Search by

mizanpage / mizanpage-php

Debelette

Client officiel de l'API Mizanpage : générer des PDF depuis vos modèles, en direct ou en file d'attente, et vérifier les webhooks.

Package info

github.com/Mizanpage/mizanpage-php

Homepage

pkg:composer/mizanpage/mizanpage-php

Statistics

Installs: 1

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.0 2026-12-02 21:25 UTC

This package is not auto-updated.

Last update: 2026-12-04 06:25:11 UTC


README

Client officiel de l'API Mizanpage pour PHP 8.1+, sans dépendance (extension cURL).

composer require mizanpage/mizanpage-php
use Mizanpage\Client;
use Mizanpage\Webhook;

$mizanpage = new Client(getenv('MIZANPAGE_KEY'));

// Le PDF dans la même réponse
$mizanpage->render(
    ['template' => 'facture', 'data' => ['values' => ['client.nom' => 'Brasserie Orlanne SRL', 'facture.total' => '7 788,00 €']]],
    'F-2026-0148', // Idempotency-Key
)->save('facture.pdf');

// Sans attendre (POST /v1/renders) : demander, attendre, télécharger
$result = $mizanpage->renders()->createAndWait(['template' => 'facture', 'reference' => 'C-2041', 'data' => ['values' => $values]]);
file_put_contents('C-2041.pdf', $result['pdf']);

// Un webhook reçu
$event = Webhook::verify(file_get_contents('php://input'), getallheaders(), getenv('MIZANPAGE_WEBHOOK_SECRET'));
Méthode Route
render($request, $idempotencyKey) POST /v1/render
renders()->create / get / wait / download / createAndWait POST /v1/renders, GET /v1/renders/{id}, GET /v1/renders/{id}/pdf
templates()->list($kind) / get($ref) / fields($ref) GET /v1/templates, GET /v1/templates/{ref}/fields
catalogs()->list / get / put /v1/catalogs
webhooks()->list / create / update / delete / test /v1/webhooks
pdf()->fromHtml($html, $options) / merge($pdfs) / split($pdf, $options) POST /v1/pdf/html, /v1/pdf/merge, /v1/pdf/split
me() GET /v1/me

Options du client : base_url, organisation (installation de partenaire), user_id, user_name, timeout, transport (une implémentation de Mizanpage\Http\Transport, par exemple autour du client HTTP de votre framework).

Une erreur de l'API lève une Mizanpage\Exception\MizanpageException avec status, errorCode et details. Documentation : https://mizanpage.com/docs/developpeurs. Référence : https://api.mizanpage.com/docs.

Développer

composer install
vendor/bin/phpunit

Licence MIT.