PHPackages                             josef.kufner.cz/lyx-on-twig - 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. josef.kufner.cz/lyx-on-twig

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

josef.kufner.cz/lyx-on-twig
===========================

Simple PHP library combining LyX and Twig to create beautiful generated documents in LaTeX.

161PHP

Since May 21Pushed 9y ago1 watchersCompare

[ Source](https://github.com/jkufner/lyx-on-twig)[ Packagist](https://packagist.org/packages/josef.kufner.cz/lyx-on-twig)[ RSS](/packages/josefkufnercz-lyx-on-twig/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependenciesVersions (1)Used By (0)

LyX on Twig
===========

[](#lyx-on-twig)

LyX-on-Twig is a simple PHP library combining LyX and Twig to create beautiful generated documents in LaTeX. User/programmer creates template in LyX using Twig constructs, this template is compiled to LaTeX source code with Twig constructs, and finally LaTeX template is populated with data, replacing Twig constructs in the process.

Example
-------

[](#example)

While editing in LyX:[![screenshot](lyx-twig-template.png)](lyx-twig-template.png)Preview PDF generated directly from LyX (left) and final document (right):[![document](example.pdf.png)](example.pdf.png)Features
--------

[](#features)

- Use LyX, a graphical WYSIWYM editor, to create template.
- Use Twig to populate the template with data.
- Everything in simple and easy-to-use package.

Requirements
------------

[](#requirements)

- Texlive installed on server.
- LyX installed on developper's computer.
- Optional: LyX on server if templates should be compiled from LyX to LaTeX on server.

Usage
-----

[](#usage)

1. Create LyX document using `lyx/twig.article.layout` as a layout file. You may want to symlink this file next to your document.
2. Use LyX to export tex template: `lyx -batch -e pdf5 template.twig.lyx`.
3. Compile the template `template.twig.tex` to PDF:

    ```
    $lyxtwig = new LyxOnTwig('./', array('cache' => './cache/'));
    $output_file = tempnam(tempnam(sys_get_temp_dir(), 'output.');
    if ($lyxtwig->render('template.twig.tex', 'template.twig.pdf', array('some' => 'data'))) {
        // Do something with PDF in $output_file
    }

    ```

PDF Properties
--------------

[](#pdf-properties)

Fortunately LyX does not escape PDF options (in document settings, PDF properties), so it is possible to use `\noexpand\Twig{expression}` to insert `expression` into PDF title or any other field. The `\noexpand` is required to stop LaTeX from expanding the `\Twig` macro which is not defined yet.

License
-------

[](#license)

The most of the code is published under Apache 2.0 license. See [LICENSE](doc/license.md) file for details.

Contribution guidelines
-----------------------

[](#contribution-guidelines)

If you wish to send me a patch, please create a Git pull request or send a Git formatted patch via email.

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity41

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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/16572?v=4)[Josef Kufner](/maintainers/jkufner)[@jkufner](https://github.com/jkufner)

---

Top Contributors

[![jkufner](https://avatars.githubusercontent.com/u/16572?v=4)](https://github.com/jkufner "jkufner (16 commits)")

### Embed Badge

![Health badge](/badges/josefkufnercz-lyx-on-twig/health.svg)

```
[![Health](https://phpackages.com/badges/josefkufnercz-lyx-on-twig/health.svg)](https://phpackages.com/packages/josefkufnercz-lyx-on-twig)
```

###  Alternatives

[limenius/react-bundle

Client and Server-side react rendering in a Symfony Bundle

3851.2M](/packages/limenius-react-bundle)[area17/laravel-auto-head-tags

Laravel Auto Head Tags helps you build the list of head elements for your app

4616.0k](/packages/area17-laravel-auto-head-tags)[jelix/wikirenderer

WikiRenderer is a library to generate HTML or anything else from wiki content.

1712.2k1](/packages/jelix-wikirenderer)[webkinder/sproutset

A Composer package for handling responsive images in Roots Bedrock + Sage + Blade projects.

281.8k](/packages/webkinder-sproutset)

PHPackages © 2026

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