PHPackages                             laudis/pandoc - 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. laudis/pandoc

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

laudis/pandoc
=============

simple wrapper for easy pandoc handling

1.0.0(5y ago)1164MITPHPCI failing

Since Dec 12Pushed 4y ago1 watchersCompare

[ Source](https://github.com/laudis-technologies/pandoc-php)[ Packagist](https://packagist.org/packages/laudis/pandoc)[ RSS](/packages/laudis-pandoc/feed)WikiDiscussions main Synced yesterday

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

Pandoc PHP
==========

[](#pandoc-php)

[![Maintainability](https://camo.githubusercontent.com/167bca0619ea5155d67cd89ab9f7d531c131602353fdab97f82f868c1812c57e/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f62623862623931636634663232356261323936632f6d61696e7461696e6162696c697479)](https://codeclimate.com/github/laudis-technologies/pandoc-php/maintainability)[![Test Coverage](https://camo.githubusercontent.com/15a38f9780098e4c74417cb735e9b84c620a5c59c5833e2dcd898b763e34d092/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f62623862623931636634663232356261323936632f746573745f636f766572616765)](https://codeclimate.com/github/laudis-technologies/pandoc-php/test_coverage)[![MIT License](https://camo.githubusercontent.com/7c124530b7c185c6928998842a1a52ed4bfd21071bf67db8f325f470cc3160a3/68747470733a2f2f696d672e736869656c64732e696f2f61706d2f6c2f61746f6d69632d64657369676e2d75692e7376673f)](https://github.com/laudis-technologies/neo4j-php-client/blob/main/LICENSE)

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

[](#installation)

Install [pandoc](https://github.com/jgm/pandoc) on your system.

Install pandoc-php with [composer](http://getcomposer.org)

```
composer require laudis/pandoc
```

Quick usage
-----------

[](#quick-usage)

Pandoc converts text using the convert method.

```
use Laudis\Pandoc\Pandoc;

$pandoc = new Pandoc();
echo $pandoc->convert('#Hello Pandoc', 'html'); //outputs Hello Pandoc
```

Pandoc converts files using the convertFile method.

```
$pandoc->convertFile(__DIR__.'/my-file.txt', 'html', 'text');
```

Building commands
-----------------

[](#building-commands)

Pandoc php also handles more complex systems by accepting commands. A builder pattern creates these.

This example builds a command which controls pandoc to convert the markdown to a temporary JSON file.

```
use Laudis\Pandoc\Commands\Command;
use Laudis\Pandoc\Enums\Option;

$command = Command::create()
    ->withContent('# H1')
    ->withOption(Option::OUTPUT_FILE(), sys_get_temp_dir() . '/tmp.json') // Use the option enumeration for easy ide integration and built in typo protection.
    ->withOption('-w', 'json'); // Strings can also describe an option

$pandoc->run($command);
```

Streams and resources
---------------------

[](#streams-and-resources)

Pandoc php supports resources!

```
use Laudis\Pandoc\Commands\Command;
use Laudis\Pandoc\Enums\Option;

$command = Command::create()
    ->withResource(fopen('https://laudis.tech', 'rb'))
    ->withOption(Option::FROM_FORMAT(), 'html')
    ->withOption(Option::TO_FORMAT(), 'pdf');

echo $pandoc->run($command);
```

Pandoc also optionally streams the result for a seamless experience.

```
foreach ($pandoc->stream($command) as $part) {
    echo $part;
}
```

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

[](#configuration)

The pandoc constructor accepts the location of the pandoc executable.

```
$pandoc = new Pandoc(); // Defaults to "pandoc" as the executable,

$pandoc = new Pandoc('/usr/bin/pandoc-beta'); // /usr/bin/pandoc-beta is now the location of the executable,
```

Version detection
-----------------

[](#version-detection)

Pandoc is also aware of the version of the executable. The version is accessible through the getVersion method.

```
$pandoc = new Pandoc();

echo $pandoc->getVersion(); // Echos the version provided in with the --version flag.
```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity53

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

Unknown

Total

1

Last Release

1976d ago

### Community

Maintainers

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

---

Top Contributors

[![transistive](https://avatars.githubusercontent.com/u/16435930?v=4)](https://github.com/transistive "transistive (10 commits)")

---

Tags

conversiondocumentshaskelljsonmarkdownpandocpdfphpphp-libraryphppdfconversionpandochaskell

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/laudis-pandoc/health.svg)

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

###  Alternatives

[pontedilana/php-weasyprint

PHP library allowing PDF generation from an url or a html page. Wrapper for Kozea/WeasyPrint.

761.1M7](/packages/pontedilana-php-weasyprint)[mostafaznv/pdf-optimizer

PDF optimization tool for PHP and Laravel applications

170125.8k](/packages/mostafaznv-pdf-optimizer)[imal-h/pdf-box

The most advanced, driver-based PDF manipulation library for PHP v3.0. Supports Ghostscript, Chrome Headless (HTML to PDF), OpenSSL/FPDI (Signing), and PDFtk (Forms).

60403.9k](/packages/imal-h-pdf-box)[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)[kartik-v/mpdf

A PHP class to generate PDF files from HTML with Unicode/UTF-8 and CJK support. This is a fork of the official mPDF library.

39328.4k1](/packages/kartik-v-mpdf)[kiwilan/php-ebook

PHP package to read metadata and extract covers from eBooks, comics and audiobooks.

3414.6k1](/packages/kiwilan-php-ebook)

PHPackages © 2026

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