PHPackages                             nelson-cms/pptr - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. nelson-cms/pptr

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

nelson-cms/pptr
===============

Simple Puppeteer wrapper for Nette

1.0.2(1y ago)024PHPPHP ^8.3

Since Jan 29Pushed 1y ago1 watchersCompare

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

READMEChangelog (6)Dependencies (9)Versions (8)Used By (0)

Puppeteer
=========

[](#puppeteer)

Install
-------

[](#install)

1. `composer require nelson-cms/pptr`.
2. Navigate to `%vendorDir%/nelson-cms/pptr` and run `npm install` - be sure to do this on the target machine!

Configuration
-------------

[](#configuration)

1. Enable the extension:

    ```
    extensions:
    	pptr: NelsonCms\Pptr\DI\PptrExtension
    ```
2. Configuration:

    ```
    pptr:
    	connection: @ssh2.connection
    	tempDir: '%tempDir%/puppeteer/'
    	timeout: 30_000 # miliseconds
    	sandbox: false
    	outline: false # Generate document outline
    	nodeCommand: 'node' # in case multiple versions are installed or for additional arguments
    	scriptPath: '%vendorDir%/nelson-cms/pptr/src/assets/generator.js'
    	httpUser: # http auth
    	httPass: # http auth
    ```

    These are the default values.

Sandbox
-------

[](#sandbox)

Using sandbox is highly encouraged (by Puppeteer team). It has to be set up on the target machine.

-

Usage
-----

[](#usage)

Most basic usage:

```
$html = 'Puppeteer testSome text paragraph';
$html .= '' . date(DateTime::ISO8601) . '';
$html .= '';

/** @var Generator $generator */
$generator = $this->generatorFactory->create();
$output = $generator->generateFromHtml($html, OutputMode::BOTH);
```

Note: The HTML is not directly passed to the node process. Instead, it is first saved to a temp file and then read by node. This is done intentionally for the generator to deal with large HTML payloads. `nesk/puphpeteer` suffers from this problem, as the data is sent via JSON (AFAIK) and crashes on large HTML, otherwise it works just fine and is a great tool.

There are currently three output modes:

- `OutputMode::PDF`
- `OutputMode::IMG`
- `OutputMode::BOTH`

These are self-explanatory.

The generator also supports generating from URL:

```
/** @var \NelsonCms\Pptr\VO\Result $result */
$result = $generator->generateFromUrl(new UrlScript('https://www.google.com'), OutputMode::BOTH);
```

```
$result->getCommand();

// array(7) {
// 	[0]=>	string(4) "node"
// 	[1]=>	string(91) "/xyz/puppeteer/src/assets/generator.js"
// 	[2]=>	string(16) "--inputMode=file"
// 	[3]=>	string(159) "--input=/xyz/puppeteer/app/../temp/puppeteer/1562653154_-_58f8da81a3c0c3399838891fe88d0db7.html"
// 	[4]=>	string(5) "--pdf"
// 	[5]=>	string(7) "--image"
// 	[6]=>	string(155) "--output=/xyz/puppeteer/app/../temp/puppeteer/1562653154_-_58f8da81a3c0c3399838891fe88d0db7"
// }

$result->getPdf(); // string(150) "/xyz/puppeteer/app/../temp/puppeteer/1562653154_-_58f8da81a3c0c3399838891fe88d0db7.pdf"
$result->getImage(); // string(150) "/xyz/puppeteer/app/../temp/puppeteer/1562653154_-_58f8da81a3c0c3399838891fe88d0db7.png"
$result->getConsole(); // string(0) ""
```

Legend:

- `pdf`/`image` are dependent on the mode used.
- `command` - raw command passed from PHP to NODE.js via Symfony/Process.
- `console` - raw output from NODE (via `console.log`). Should be empty in most cases.

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance44

Moderate activity, may be stable

Popularity6

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 ~6 days

Total

6

Last Release

445d ago

PHP version history (2 changes)1.0.0PHP ^8.3

0.7.3.0PHP ^7.3 | ^8.0

### Community

Maintainers

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

---

Top Contributors

[![Gappa](https://avatars.githubusercontent.com/u/749981?v=4)](https://github.com/Gappa "Gappa (7 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/nelson-cms-pptr/health.svg)

```
[![Health](https://phpackages.com/badges/nelson-cms-pptr/health.svg)](https://phpackages.com/packages/nelson-cms-pptr)
```

###  Alternatives

[contributte/menu-control

Menu control for Nette framework

29108.6k1](/packages/contributte-menu-control)[carrooi/nette-menu

Menu control for Nette framework

2950.0k1](/packages/carrooi-nette-menu)[ipub/gravatar

Gravatar creator for Nette Framework

122.0k1](/packages/ipub-gravatar)

PHPackages © 2026

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