PHP SDK reference
The core API is shared by plain PHP and the Laravel 2.x adapter. Fluent methods return static, so adapter subclasses retain their type.
BladePdf factory
| Method | Result |
|---|---|
BladePdf::create($apiKey, $clientOptions, $assetOptions, $httpClient) | Configured SDK instance. |
make() | Empty PendingRender. |
fromHtml($html, $baseDirectory) | HTML render builder. |
fromTemplate($templateId, $context) | Cloud-template render builder. |
PendingRender
Source and content methods include fromHtml(), fromTemplate(), withHeaderHtml(), withFooterHtml(), context(), and withContext().
Options include format(), paperSize(), margins(), landscape(), portrait(), showBackground(), transparentBackground(), scale(), pageRanges(), taggedPdf(), preferCssPageSize(), waitForFonts(), outline(), emulateMedia(), waitUntil(), and waitFunction().
Delivery and request methods include reference(), templateName(), storePdf(), webhook(), resolveAssets(), withAsset(), overrideAsset(), render(), and async().
Results and submissions
| Type | API |
|---|---|
RenderResult | pdf(), save(), base64(), base64Pdf(), storedPdfUrl(), requestId(). |
RenderSubmission | Readonly requestId and optional reference. |
RenderRequest | Immutable typed transport input used by RenderClient implementations and fakes. |
Exceptions
Catch BladePDF\Exceptions\BladePdfException. More specific exceptions cover missing credentials, invalid configuration, missing or denied assets, write failures, and render failures. RenderFailedException exposes statusCode(), requestId(), and responseBody().
Webhook signatures
BladePDF\Webhooks\SignatureVerifier::isValid() accepts the exact raw body, timestamp header, signature header, secret, tolerance, and an optional current timestamp for deterministic tests.