Developer quickstart
Generate PDFs in PHP and Laravel
Use Laravel’s HTTP client to send document data and store the binary PDF response.
Prerequisites
- A PDFDesignAPI account and API token.
- A template UUID with a schema and at least one data binding.
- Trusted server-side code where the token remains secret.
Generate and save the PDF
use IlluminateSupportFacadesHttp;
use IlluminateSupportFacadesStorage;
$response = Http::withToken(config('services.pdfdesignapi.token'))
->timeout(60)
->post(
'https://pdfdesignapi.com/api/v1/generate/single/'.config('services.pdfdesignapi.template_uuid'),
['data' => ['customer' => ['name' => 'Example BV']]],
);
$response->throw();
Storage::disk('local')->put('documents/document.pdf', $response->body());Production notes
- Place tokens in environment-backed Laravel configuration.
- Authorize access when serving the stored PDF.
- Queue asynchronous or batch document work instead of doing it inside a long browser request.