Quick start
This page walks through your first render — from key to PDF — without touching the dashboard.
Set your API key
Section titled “Set your API key”Export your key into the environment your script runs in:
export POLI_PAGE_API_KEY=pp_test_...Render a PDF
Section titled “Render a PDF”<?php
require __DIR__ . '/vendor/autoload.php';
use PoliPage\PoliPage;use PoliPage\ProjectModeInput;
$client = PoliPage::client($_ENV['POLI_PAGE_API_KEY']);
$pdf = $client->render->pdf(new ProjectModeInput( project: 'billing', template: 'invoice', data: ['invoiceNumber' => 'INV-001', 'total' => 1280],));$pdf is a binary string. Write it to disk, stream it to S3, or send it back through an HTTP response.
Example
Section titled “Example”<?php
require __DIR__ . '/vendor/autoload.php';
use PoliPage\PoliPage;use PoliPage\ProjectModeInput;
$client = PoliPage::client($_ENV['POLI_PAGE_API_KEY']);
$pdf = $client->render->pdf(new ProjectModeInput( project: 'billing', template: 'invoice', data: ['invoiceNumber' => 'INV-001', 'total' => 1280],));
file_put_contents('./invoice.pdf', $pdf);