The whole integration
No extensions beyond cURL, which your PHP install already has.
<?php
$ch = curl_init('https://api.filecook.com/render/pdf');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('FILECOOK_API_KEY'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'html' => '<h1>Invoice #1042</h1>',
'options' => ['format' => 'A4', 'margin' => '12mm'],
]),
]);
$pdf = curl_exec($ch);
curl_close($ch);
file_put_contents('invoice.pdf', $pdf);
Why the classic PHP libraries struggle
Dompdf and TCPDF are pure-PHP layout engines. That makes them easy to install and genuinely useful for simple, table-driven documents — but they implement only a subset of CSS, and neither executes JavaScript. Flexbox and Grid layouts collapse, and anything a front-end library draws at runtime never appears.
- Filecook renders in Chromium, so the PDF matches what you see in the browser
- No PHP memory_limit tuning for large documents — the work happens off-box
- No pinned library version quietly breaking on a PHP upgrade
Laravel, Symfony, and WordPress
In Laravel, render a Blade view with view()->render() and post the string. In Symfony, do the same with Twig. In WordPress, capture a template with output buffering. In every case the API takes a string of HTML and hands back bytes, so it slots in wherever you already build markup.
Frequently asked questions
Can I use this from Laravel?
Will my existing Dompdf templates work?
Do you support modern CSS like Grid and Flexbox?
Can I use Google Fonts or my own web fonts?
@import in your stylesheet, a <link> tag, or a self-hosted @font-face rule. The renderer waits for fonts to load before it captures the page.