PHPackages                             open-administration/php-latex-renderer - 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. [Templating &amp; Views](/categories/templating)
4. /
5. open-administration/php-latex-renderer

ActiveLibary[Templating &amp; Views](/categories/templating)

open-administration/php-latex-renderer
======================================

Renders LaTeX Templates in PHP

1.2.0(11mo ago)11.0k1MITPHPPHP ^8.0CI failing

Since Nov 12Pushed 11mo ago1 watchersCompare

[ Source](https://github.com/OpenAdministration/php-latex-renderer)[ Packagist](https://packagist.org/packages/open-administration/php-latex-renderer)[ RSS](/packages/open-administration-php-latex-renderer/feed)WikiDiscussions main Synced 1mo ago

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

php-latex-renderer
==================

[](#php-latex-renderer)

wraps latex rendering and generating with twig templates. This library does

- using twig for latex templating
- inserting user data into latex templates
- escaping user data, so no (new) latex commands can be introduced by userdata
- renders latex file and returns pdf
- has compact latex error logs

Installation
============

[](#installation)

Installation via composer is suggested

```
composer require open-administration/php-latex-renderer

```

Usage
=====

[](#usage)

```
require './vendor/autoload.php';

$tex = new LatexRenderer('./templates/'); // setTmpDir('./runtime/'); // renderPdf('simple-report', [ //  'My Custom Title', //  'Me!',
]);
// output / save the pdf with
file_put_contents('main.pdf', $pdf);
// or echo with fitting header
header("Content-type:application/pdf");
echo $pdf;
```

### Twig options

[](#twig-options)

The following symbols are used for twig templating

```
$options = [
    'tag_block' => ['(%', '%)'],
    'tag_comment' => ['(!', '!)'],
    'tag_variable' => ['((', '))'],
];
```

due to `{{`, `{#` and `{%` are too common in regular latex code. Be carefull with `((` it is easy to use it in calculations as well. You can use

```
$tex->setTwigLexer($options)
```

for custom variants.

### Meta Twig Context

[](#meta-twig-context)

There is a new introduced global variable `_tex`, which can be used everywhere and is defined like:

```
$this->twig->addGlobal('_tex', [
    'files' => $fileNames, // with name.pdf => files/name.pdf (local path in dir)
    'dir' => $tmpDir . "tex/$templateName/$uid/",
    'template' => $twigTemplateName,
]);
```

Example: `_tex.dir`

### Try the sample

[](#try-the-sample)

```
php -f samples/simple-report.php

```

Examples
========

[](#examples)

You can find some real world examples in the `samples` Folder

Contribute
==========

[](#contribute)

Please run

```
composer cs-fix

```

and commit the changes in an extra commit before doing a pull request

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance51

Moderate activity, may be stable

Popularity19

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

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

Recently: every ~318 days

Total

10

Last Release

348d ago

PHP version history (2 changes)v1.0.0PHP ^7.4|^8.0

1.1.9PHP ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/49d3d4c45f7ca9e84f55afbf43783e7ffb63e05398ed768c289ff3b55b09da2f?d=identicon)[lukas-staab](/maintainers/lukas-staab)

---

Top Contributors

[![lukas-staab](https://avatars.githubusercontent.com/u/14363325?v=4)](https://github.com/lukas-staab "lukas-staab (48 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")

---

Tags

latexphptwigtwig-templates

###  Code Quality

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/open-administration-php-latex-renderer/health.svg)

```
[![Health](https://phpackages.com/badges/open-administration-php-latex-renderer/health.svg)](https://phpackages.com/packages/open-administration-php-latex-renderer)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.4k37.3k](/packages/matomo-matomo)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[drupal/core

Drupal is an open source content management platform powering millions of websites and applications.

19462.3M1.3k](/packages/drupal-core)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[drupal/core-recommended

Locked core dependencies; require this project INSTEAD OF drupal/core.

6939.5M343](/packages/drupal-core-recommended)

PHPackages © 2026

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