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

ActiveLibrary

ueberdosis/pandoc
=================

Pandoc PHP Package

0.9.0(3y ago)83151.1k—2.7%9[2 PRs](https://github.com/ueberdosis/pandoc/pulls)2MITPHPPHP ^7.1|^8.0

Since Mar 18Pushed 3y ago1 watchersCompare

[ Source](https://github.com/ueberdosis/pandoc)[ Packagist](https://packagist.org/packages/ueberdosis/pandoc)[ Docs](https://github.com/ueberdosis/pandoc)[ GitHub Sponsors](https://github.com/sponsors/ueberdosis/)[ RSS](/packages/ueberdosis-pandoc/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (2)Versions (16)Used By (2)

Pandoc PHP Package
==================

[](#pandoc-php-package)

[![](https://camo.githubusercontent.com/80204cfcf36b539f16ea520700343cc6d1f3a6351e1a3454c4439599c68a216a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7565626572646f7369732f70616e646f632e737667)](https://packagist.org/packages/ueberdosis/pandoc)[![Integrate](https://github.com/ueberdosis/pandoc/workflows/run-tests/badge.svg?branch=main)](https://github.com/ueberdosis/pandoc/actions)[![](https://camo.githubusercontent.com/6cf1fdfd584014c3f7e10865449b5b0bd3e1bc351989cd4c9900f1fa243ac90f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7565626572646f7369732f70616e646f632e737667)](https://packagist.org/packages/ueberdosis/pandoc)[![Sponsor](https://camo.githubusercontent.com/ee73cad5907779cdf16e865239ea623ca0bd44ccd5ad44fa7bfe7a5ac3ced298/68747470733a2f2f696d672e736869656c64732e696f2f7374617469632f76313f6c6162656c3d53706f6e736f72266d6573736167653d254532253944254134266c6f676f3d476974487562)](https://github.com/sponsors/ueberdosis)

If you need to convert text files from one format to another, [pandoc](https://pandoc.org/) is your swiss-army knife. This package is a PHP wrapper for pandoc.

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

[](#installation)

You can install the package via composer:

```
composer require ueberdosis/pandoc
```

This package is a wrapper for the command-line tool pandoc. Don’t forget to install pandoc. Here is an example for Ubuntu:

```
sudo apt-get update
sudo apt-get install -y wget
sudo mkdir -p /usr/src/pandoc
cd /usr/src/pandoc
sudo wget https://github.com/jgm/pandoc/releases/download/2.15/pandoc-2.15-1-amd64.deb
sudo dpkg -i pandoc-2.15-1-amd64.deb
```

[More examples are available in the pandoc documentation](https://pandoc.org/installing.html)

Usage
-----

[](#usage)

### Return the converted text as string

[](#return-the-converted-text-as-string)

```
$output = (new \Pandoc\Pandoc)
    ->from('markdown')
    ->input('# Test')
    ->to('html')
    ->run();
```

### Use a file as input and write a file as output

[](#use-a-file-as-input-and-write-a-file-as-output)

```
(new \Pandoc\Pandoc)
    ->from('markdown')
    ->inputFile('tests/data/example.md')
    ->to('plain')
    ->output('tests/temp/example.txt')
    ->run();
```

### Change path to Pandoc

[](#change-path-to-pandoc)

```
new \Pandoc\Pandoc([
    'command' => '/usr/local/bin/pandoc',
]);
```

### Change working directory

[](#change-working-directory)

```
(new \Pandoc\Pandoc)->cwd('/tmp/pandoc/');
```

### List available input formats

[](#list-available-input-formats)

```
(new \Pandoc\Pandoc)->listInputFormats();
```

### List available output formats

[](#list-available-output-formats)

```
(new \Pandoc\Pandoc)->listOutputFormats();
```

### Write a log file

[](#write-a-log-file)

```
echo (new \Pandoc\Pandoc)
    ->from('markdown')
    ->input('# Markdown')
    ->to('html')
    ->log('log.txt')
    ->run();
```

### Retrieve Pandoc version

[](#retrieve-pandoc-version)

```
echo (new \Pandoc\Pandoc)->version();
```

### Use magic methods to make calls shorter

[](#use-magic-methods-to-make-calls-shorter)

```
$output = (new \Pandoc\Pandoc)
    ->fromMarkdown('# Test')
    ->toHtml('tests/temp/example.txt')
    ->run();
```

### Pass options to Pandoc

[](#pass-options-to-pandoc)

```
echo (new \Pandoc\Pandoc)
    ->fromMarkdown('# Test')
    ->toHtml('tests/temp/example.txt')
    ->option('fail-if-warnings')
    ->option('data-dir', './tmp')
    ->run();
```

See  for a full list of available options

### Laravel Facade

[](#laravel-facade)

This package includes a Laravel facade for people that like that little bit of syntactic sugar.

```
echo \Pandoc\Facades\Pandoc::version();
```

### Exceptions

[](#exceptions)

If something went wrong, the package throws a generic `\Symfony\Component\Process\Exception\ProcessFailedException`. There are even a few specific exceptions.

- \\Pandoc\\Exceptions\\PandocNotFound
- \\Pandoc\\Exceptions\\InputFileNotFound
- \\Pandoc\\Exceptions\\UnknownInputFormat
- \\Pandoc\\Exceptions\\UnknownOutputFormat
- \\Pandoc\\Exceptions\\LogFileNotWriteable
- \\Pandoc\\Exceptions\\BadMethodCall

### Testing

[](#testing)

```
composer test
```

### Changelog

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Credits
-------

[](#credits)

- [Hans Pagel](https://github.com/hanspagel)
- [Miguel Piedrafita](https://github.com/m1guelpf)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity47

Moderate usage in the ecosystem

Community22

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 66.4% 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 ~98 days

Recently: every ~268 days

Total

12

Last Release

1176d ago

PHP version history (2 changes)0.1.0PHP ^7.1

0.7.0PHP ^7.1|^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/3670ca0ea5e329d23070e3707db7bab7ab788a31fa16678507c0c14b858bcff5?d=identicon)[patrickbaber](/maintainers/patrickbaber)

![](https://www.gravatar.com/avatar/98f238189eab12ef0f354c0d9ec61f6c7f7c7e75564e3b3b0c79fed22396888b?d=identicon)[timoisik](/maintainers/timoisik)

---

Top Contributors

[![hanspagel](https://avatars.githubusercontent.com/u/1577992?v=4)](https://github.com/hanspagel "hanspagel (83 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (25 commits)")[![patrickbaber](https://avatars.githubusercontent.com/u/3321255?v=4)](https://github.com/patrickbaber "patrickbaber (8 commits)")[![cheryllium](https://avatars.githubusercontent.com/u/5027241?v=4)](https://github.com/cheryllium "cheryllium (5 commits)")[![m1guelpf](https://avatars.githubusercontent.com/u/23558090?v=4)](https://github.com/m1guelpf "m1guelpf (2 commits)")[![mejo-](https://avatars.githubusercontent.com/u/3582805?v=4)](https://github.com/mejo- "mejo- (1 commits)")[![peter279k](https://avatars.githubusercontent.com/u/9021747?v=4)](https://github.com/peter279k "peter279k (1 commits)")

---

Tags

laravelpandocphpueberdosispandoc

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[spatie/laravel-health

Monitor the health of a Laravel application

86910.0M83](/packages/spatie-laravel-health)[illuminate/console

The Illuminate Console package.

12944.1M5.1k](/packages/illuminate-console)[ueberdosis/tiptap-php

A PHP package to work with Tiptap output

2669.2M34](/packages/ueberdosis-tiptap-php)[temporal/sdk

Temporal SDK

4002.2M18](/packages/temporal-sdk)[illuminate/process

The Illuminate Process package.

44699.5k65](/packages/illuminate-process)[statamic/cli

Statamic CLI Tool

7587.7k](/packages/statamic-cli)

PHPackages © 2026

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