PHPackages                             devture/browserless - 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. [PDF &amp; Document Generation](/categories/documents)
4. /
5. devture/browserless

ActiveLibrary[PDF &amp; Document Generation](/categories/documents)

devture/browserless
===================

Library for communicating with the Browserless.io API (generating PDFs, etc.)

2.0.1(5mo ago)39.8k↑27.3%BSD-3-ClausePHPPHP &gt;=8.0

Since Mar 17Pushed 5mo ago1 watchersCompare

[ Source](https://github.com/devture/browserless)[ Packagist](https://packagist.org/packages/devture/browserless)[ RSS](/packages/devture-browserless/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (2)Versions (8)Used By (0)

Browserless
===========

[](#browserless)

This is a library for interacting with the [Browserless.io](https://www.browserless.io) APIs.

For the time being, this library only supports these APIs:

- [/pdf](https://docs.browserless.io/docs/pdf.html) - for generating PDFs from a URL or inline HTML (like [wkhtmltopdf](https://wkhtmltopdf.org/), but better -- more up-to-date browser engine, etc.)

Prerequisites
-------------

[](#prerequisites)

You either need to use your own self-hosted Browserless instance (see how to do it with [Docker](https://docs.browserless.io/docker/quickstart)) or their hosted offering (see [Pricing](https://www.browserless.io/pricing/)).

You could use the following `compose.yml` setup:

```
version: '2.1'

services:
  browserless:
    image: ghcr.io/browserless/chromium:v2.23.0
    restart: unless-stopped
    # Matches the owner (`blessuser:blessuser`) of `/usr/src/app`
    user: 999:999
    environment:
      CONCURRENT: 10
      TOKEN: SOME_TOKEN_HERE
    # Not exposing the port is recommended, if PHP is running in a container alongisde this one
    ports:
      - "127.0.0.1:3000:3000"
    tmpfs:
      - /tmp
```

Usage
-----

[](#usage)

### Creating a Browserless API client

[](#creating-a-browserless-api-client)

```
$browserlessApiUrl = 'http://localhost:3000'; // Or 'http://browserless:3000', etc.
$browserlessToken = 'SOME_TOKEN_HERE';
$browserlessTimeoutSeconds = 15;

$client = new \Devture\Component\Browserless\Client(
	new \GuzzleHttp\Client(),
	$browserlessApiUrl,
	$browserlessToken,
	$browserlessTimeoutSeconds,
);
```

### Generating a PDF from a URL

[](#generating-a-pdf-from-a-url)

```
$url = 'https://devture.com';

$pdfCreationRequest = new \Devture\Component\Browserless\Model\PdfCreationRequest();
$pdfCreationRequest->setUrl($url);
$pdfCreationRequest->setOptions([
	'printBackground' => true,
	'format' => 'A4',
	'landscape' => true,
]);

$pdfBytes = $client->createPdfFromRequest($pdfCreationRequest);
```

### Generating a PDF from inline HTML

[](#generating-a-pdf-from-inline-html)

```
$html = 'Some HTML here';

$pdfCreationRequest = new \Devture\Component\Browserless\Model\PdfCreationRequest();
$pdfCreationRequest->setHtml($html);
$pdfCreationRequest->setOptions([
	'printBackground' => true,
	'format' => 'A4',
	'margin' => [
		'top' => '20mm',
		'bottom' => '10mm',
		'left' => '10mm',
		'right' => '10mm',
	],
]);

$pdfBytes = $client->createPdfFromRequest($pdfCreationRequest);
```

Alternatives
------------

[](#alternatives)

- [gosuperscript/browserless-php](https://packagist.org/packages/gosuperscript/browserless-php)
- the [SynergiTech/chrome-pdf-php](https://github.com/SynergiTech/chrome-pdf-php) library can also render PDFs via Browserless
- [wkhtmltopdf](https://wkhtmltopdf.org/) invoked via [knplabs/knp-snappy](https://github.com/KnpLabs/snappy)

###  Health Score

45

—

FairBetter than 93% of packages

Maintenance71

Regular maintenance activity

Popularity28

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

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

Every ~226 days

Recently: every ~261 days

Total

7

Last Release

165d ago

Major Versions

1.1.0 → 2.02024-11-26

### Community

Maintainers

![](https://www.gravatar.com/avatar/9daf523f8e47ddeb8af23183c06721c4e89111eb4eb3f9ce264242b373e9dd80?d=identicon)[spantaleev](/maintainers/spantaleev)

---

Top Contributors

[![spantaleev](https://avatars.githubusercontent.com/u/388669?v=4)](https://github.com/spantaleev "spantaleev (8 commits)")

---

Tags

browserlesschromepdfpdf-generationpuppeteerpdfchromebrowserless

### Embed Badge

![Health badge](/badges/devture-browserless/health.svg)

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

###  Alternatives

[spatie/browsershot

Convert a webpage to an image or pdf using headless Chrome

5.2k32.1M102](/packages/spatie-browsershot)[chrome-php/chrome

Instrument headless chrome/chromium instances from PHP

2.6k4.5M64](/packages/chrome-php-chrome)[gotenberg/gotenberg-php

A PHP client for interacting with Gotenberg, a developer-friendly API for converting numerous document formats into PDF files, and more!

3685.2M19](/packages/gotenberg-gotenberg-php)[spiritix/php-chrome-html2pdf

A PHP library for converting HTML to PDF using Google Chrome

153472.0k3](/packages/spiritix-php-chrome-html2pdf)[daandesmedt/phpheadlesschrome

A PHP wrapper for using Google Chrome Headless mode. Convert URL or HTML to a PDF / screenshot. Easy to use and OOP interfaced.

92233.1k](/packages/daandesmedt-phpheadlesschrome)[aspose-cloud/aspose-words-cloud

Open, generate, edit, split, merge, compare and convert Word documents. Integrate Cloud API into your solutions to manipulate documents. Convert PDF to Word (DOC, DOCX, ODT, RTF and HTML) and in the opposite direction.

32157.4k](/packages/aspose-cloud-aspose-words-cloud)

PHPackages © 2026

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