PHPackages                             bladepdf/php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. bladepdf/php

ActiveLibrary[API Development](/categories/api)

bladepdf/php
============

Framework-agnostic PHP SDK for the BladePDF managed Chromium API.

v1.0.0(yesterday)021↑2614.3%MITPHPPHP ^8.2CI passing

Since Aug 28Pushed yesterdayCompare

[ Source](https://github.com/bladepdf/bladepdf-php)[ Packagist](https://packagist.org/packages/bladepdf/php)[ Docs](https://bladepdf.com)[ RSS](/packages/bladepdf-php/feed)WikiDiscussions main Synced today

READMEChangelog (1)Dependencies (3)Versions (2)Used By (0)

BladePDF PHP SDK
================

[](#bladepdf-php-sdk)

Framework-agnostic PHP client for the [BladePDF](https://bladepdf.com) rendering API. It provides the fluent render builder, Guzzle transport, secure local asset pipeline, typed results, structured exceptions, and webhook signature verification used by all BladePDF PHP integrations.

Requirements
------------

[](#requirements)

- PHP 8.2 or newer
- A BladePDF API key

Installation
------------

[](#installation)

```
composer require bladepdf/php
```

The SDK does not load `.env` or framework configuration. Pass credentials and filesystem permissions explicitly.

Quickstart
----------

[](#quickstart)

```
use BladePDF\BladePdf;

$bladePdf = BladePdf::create($_ENV['BLADEPDF_API_KEY']);

$result = $bladePdf
    ->fromHtml('Invoice INV-42')
    ->format('A4')
    ->showBackground()
    ->render();

$result->save(__DIR__.'/invoice.pdf');
```

Template engines such as Twig and Latte are supported by rendering them to an HTML string first and passing that string to `fromHtml()`.

Local assets
------------

[](#local-assets)

Automatic filesystem access is disabled unless allowed roots are configured:

```
use BladePDF\Assets\AssetResolverOptions;
use BladePDF\BladePdf;

$bladePdf = BladePdf::create(
    apiKey: $_ENV['BLADEPDF_API_KEY'],
    assetOptions: new AssetResolverOptions(
        documentRoot: __DIR__.'/public',
        searchRoots: [__DIR__.'/public', __DIR__.'/storage/pdf-assets'],
        localHosts: ['localhost', 'app.example.test'],
    ),
);

$result = $bladePdf
    ->fromHtml('')
    ->render();
```

Resolved files must remain inside an allowed real path; traversal and symlink escapes are rejected. Use `withAsset($path, $target)` when a caller intentionally grants one file outside the configured roots.

HTML attributes, `srcset`, inline styles, stylesheets, nested CSS `url()` references, and `@import` are resolved recursively. JavaScript referenced by `` and external SVG files are uploaded as opaque files. The SDK does not parse JavaScript imports, `fetch()`, runtime URLs, SVG contents, or dependencies inside SVG.

Async rendering
---------------

[](#async-rendering)

```
$submission = $bladePdf
    ->fromTemplate('invoice.standard', ['invoice' => ['number' => 'INV-42']])
    ->reference('INV-42')
    ->storePdf()
    ->webhook('https://example.test/webhooks/bladepdf', 'whsec_...')
    ->async();

echo $submission->requestId;
```

Webhook verification
--------------------

[](#webhook-verification)

```
use BladePDF\Webhooks\SignatureVerifier;

$valid = SignatureVerifier::isValid(
    rawBody: file_get_contents('php://input'),
    timestamp: $_SERVER['HTTP_BLADEPDF_TIMESTAMP'] ?? null,
    signature: $_SERVER['HTTP_BLADEPDF_SIGNATURE'] ?? null,
    secret: $_ENV['BLADEPDF_WEBHOOK_SECRET'],
);
```

Advanced dependency injection
-----------------------------

[](#advanced-dependency-injection)

`BladePDF\BladePdf` can be constructed with any `BladePDF\Contracts\RenderClient` and `BladePDF\Assets\AssetResolver`. `BladePdf::create()` also accepts `ClientOptions`, `AssetResolverOptions`, and a PSR-compatible `GuzzleHttp\ClientInterface` for transport customization and tests.

Errors
------

[](#errors)

Catch `BladePDF\Exceptions\BladePdfException` for SDK errors. `RenderFailedException` exposes the HTTP status, request ID, and response body through typed accessors. Failed filesystem writes throw `UnableToWritePdfException`.

License
-------

[](#license)

BladePDF PHP is open-source software licensed under the [MIT License](LICENSE).

###  Health Score

42

—

FairBetter than 88% of packages

Maintenance100

Actively maintained with recent releases

Popularity9

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ec80e9ebe8a059054959326ad21f1dee47896139d0a3a40611549c7e9193d130?d=identicon)[bladepdf](/maintainers/bladepdf)

---

Tags

apibladepdfchromiumcomposerhtml-to-pdfpdfpdf-apipdf-generationphpphp-libraryphp-sdkwebhooksapipdfphp-sdkchromiumhtml-to-pdfbladepdf

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/bladepdf-php/health.svg)

```
[![Health](https://phpackages.com/badges/bladepdf-php/health.svg)](https://phpackages.com/packages/bladepdf-php)
```

###  Alternatives

[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

353.6k](/packages/eslazarev-wildberries-sdk)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3661.3M49](/packages/tencentcloud-tencentcloud-sdk-php)[resend/resend-php

Resend PHP library.

608.3M55](/packages/resend-resend-php)[files.com/files-php-sdk

Files.com PHP SDK

2482.9k](/packages/filescom-files-php-sdk)[checkout/checkout-sdk-php

Checkout.com SDK for PHP

563.6M16](/packages/checkout-checkout-sdk-php)[scriptdevelop/whatsapp-manager

Paquete para manejo de WhatsApp Business API en Laravel

793.9k](/packages/scriptdevelop-whatsapp-manager)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
