PHPackages                             rarst/meadow - 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. rarst/meadow

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

rarst/meadow
============

WordPress templating DSL

0.3(7y ago)7215341MITPHPPHP &gt;=7.0

Since Apr 13Pushed 7y ago8 watchersCompare

[ Source](https://github.com/Rarst/meadow)[ Packagist](https://packagist.org/packages/rarst/meadow)[ Docs](https://github.com/Rarst/meadow)[ RSS](/packages/rarst-meadow/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependencies (3)Versions (4)Used By (1)

Meadow — WordPress Templating DSL
=================================

[](#meadow--wordpress-templating-dsl)

*Write WordPress theme templates with familiar ease and modern features.*

[![Scrutinizer Code Quality](https://camo.githubusercontent.com/7c06224646dddff3774982488a43dedb3b02d33907aa6915d2af1b0aa9c14820/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f52617273742f6d6561646f772f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Rarst/meadow/?branch=master)[![Version](https://camo.githubusercontent.com/544081eded36f0e112dbcb815d672f5bc679f6b5fc71ea22d166d495022bb06a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f72617273742f6d6561646f772e7376673f6c6162656c3d76657273696f6e)](https://packagist.org/packages/rarst/meadow)[![PHP required](https://camo.githubusercontent.com/9ced142ff68c6d5d821612b7c7b8c309ded5cf3b961df27311610b520478b6de/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f72617273742f6d6561646f772e737667)](https://packagist.org/packages/rarst/meadow)[![PDS Skeleton](https://camo.githubusercontent.com/50d01a5094afcc3a827c3cadaec43d23b2a256cb249f5fdd6e5ffdb53ea7971c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7064732d736b656c65746f6e2d626c75652e7376673f7374796c653d666c61742d737175617265)](https://github.com/php-pds/skeleton)

Meadow is a theme templating solution, aiming to find a balance between native WordPress concepts and power of [Twig](http://twig.sensiolabs.org/) dedicated templating language.

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

[](#installation)

Require package in your theme project with [Composer](https://getcomposer.org/):

```
composer require rarst/meadow
```

Instantiate object some time during theme load:

```
$meadow = new \Rarst\Meadow\Core;
$meadow->enable();
```

Templating
----------

[](#templating)

Meadow follows conventions of WordPress [template hierarchy](https://codex.wordpress.org/Template_Hierarchy#Visual_Overview):

- for example `index.php` becomes `index.twig`.
- `{{ get_header() }}` will look for `header.twig` (with fallback to `header.php`)
- and so on.

### Template Tags

[](#template-tags)

Template Tags API (and PHP functions in general) are set up to work transparently from Twig templates:

```
{{ the_title() }}
```

### Filters

[](#filters)

WordPress filters set up to be available as Twig filters:

```
{{ 'This is the title'|the_title }}
```

### Template Inheritance

[](#template-inheritance)

Full range of Twig functionality is naturally available, including [template inheritance](http://twig.sensiolabs.org/doc/templates.html#template-inheritance):

```
{# single.twig #}
{% extends 'index.twig' %}

{% block entry_title %}
	{{ parent() }}
{% endblock %}
```

To inherit parent template in child theme prepend it with folder's name:

```
{# child-theme/index.twig #}
{% extends 'parent-theme/index.twig' %}
```

Domain Specific Language
------------------------

[](#domain-specific-language)

Meadow attempts not just "map" WordPress to Twig, but also meaningfully extend both to improve historically clunky WP constructs.

This is primarily achieved by implementing custom Twig tags, abstracting away complexities for specific tasks.

### Loop

[](#loop)

```
{% loop %}
	{{ the_title() }}
	{{ the_content() }}
{% endloop %}
```

### Secondary Loop

[](#secondary-loop)

```
{% loop { 'post_type' : 'book', 'orderby' : 'title' } %} {# expression for arguments #}
	{{ the_title() }}
	{{ the_content() }}
{% endloop %}
```

### Comments

[](#comments)

```

	{% comments %}

		{{ comment_text() }}
	{# no  - self-closing #}
	{% endcomments %}

```

Template Examples
-----------------

[](#template-examples)

In [Hybrid Wing](https://github.com/Rarst/hybrid-wing) theme (work in progress):

- [`index.twig`](https://github.com/Rarst/hybrid-wing/blob/master/index.twig)
- [`single.twig`](https://github.com/Rarst/hybrid-wing/blob/master/single.twig)
- [`single-post.twig`](https://github.com/Rarst/hybrid-wing/blob/master/single-post.twig)
- [`comments.twig`](https://github.com/Rarst/hybrid-wing/blob/master/comments.twig)

License
-------

[](#license)

MIT

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity50

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

Total

3

Last Release

2692d ago

PHP version history (2 changes)0.1PHP &gt;=5.4

0.3PHP &gt;=7.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/689ddc4f33541ac4a001d247e560f8805d219a95e7e42a16e0d22b9409f385cb?d=identicon)[Rarst](/maintainers/Rarst)

---

Top Contributors

[![Rarst](https://avatars.githubusercontent.com/u/737584?v=4)](https://github.com/Rarst "Rarst (51 commits)")

---

Tags

twigwordpresswordpresstwig

### Embed Badge

![Health badge](/badges/rarst-meadow/health.svg)

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

###  Alternatives

[timber/timber

Create WordPress themes with beautiful OOP code and the Twig Template Engine

5.7k3.4M111](/packages/timber-timber)[rcrowe/twigbridge

Adds the power of Twig to Laravel

9105.9M50](/packages/rcrowe-twigbridge)[twig/cssinliner-extra

A Twig extension to allow inlining CSS

23018.5M55](/packages/twig-cssinliner-extra)[symfony/ux-twig-component

Twig components for Symfony

21814.8M162](/packages/symfony-ux-twig-component)[twig/markdown-extra

A Twig extension for Markdown

12114.3M83](/packages/twig-markdown-extra)[symfony/ux-live-component

Live components for Symfony

1635.6M72](/packages/symfony-ux-live-component)

PHPackages © 2026

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