Installation
Install the Laravel adapter and connect it to the API key from your BladePDF dashboard. Plain PHP and server-side Node.js applications can install their framework-agnostic SDK directly.
Requirements
| Requirement | Version | Why |
|---|---|---|
| PHP | 8.2+ |
The package uses modern typed PHP. |
| Laravel components | 11.x through 13.x |
Container integration, configuration, responses, and Blade view rendering. |
| Node.js SDK | Node.js 22+ |
Server-side ESM or CommonJS with native fetch, filesystem, and stream APIs. |
| BladePDF account | Active account | Provides API keys, cloud templates, assets, analytics, and webhooks. |
Install the package
1composer require bladepdf/laravel:^2.0
Laravel package auto-discovery registers the service provider and the BladePDF facade alias automatically.
Plain PHP or another framework
Install the shared core instead. It has no Illuminate dependency and does not read environment variables automatically.
1composer require bladepdf/php:^1.0Continue with the PHP SDK quickstart.
Server-side Node.js
Install the official TypeScript-first SDK. It has no runtime dependencies and does not read environment variables automatically.
1npm install @bladepdf/nodeContinue with the Node.js SDK quickstart.
Add your API key
Create an API key in the dashboard and place it in your environment file.
1BLADEPDF_API_KEY=blpdf_xxxxxxxxxxxxxxxxxxxxxxxx
Configuration is auto-discovered. Publish the config only when you need custom timeouts, retries, SSL settings, or asset resolution. See Configuration for the publish command and available options.
Only call BladePDF from trusted backend code. Do not expose your API key in JavaScript, mobile apps, public repositories, or browser requests.
Verify the installation
Add a temporary route and request it from your browser or an HTTP test.
1use BladePDF\Laravel\Facades\BladePDF;
2
3Route::get('/bladepdf-check', function () {
4 return BladePDF::fromHtml('<h1>BladePDF is installed</h1>')
5 ->format('A4')
6 ->render()
7 ->response('check.pdf');
8});
Importing the facade
Use the package facade directly:
1use BladePDF\Laravel\Facades\BladePDF;
If you prefer a shorter alias in your own application, create one in your app code, but the official docs use BladePDF::.