PHPackages                             nedryse/latte-template-macroset - 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. nedryse/latte-template-macroset

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

nedryse/latte-template-macroset
===============================

Placeholder replacement Latte macro provides simple way to put the content of variables into the right places.

v1.0.0(11y ago)018WTFPLPHPPHP &gt;=5.3.1

Since Dec 27Pushed 11y ago2 watchersCompare

[ Source](https://github.com/nedryse/latte-template-macroset)[ Packagist](https://packagist.org/packages/nedryse/latte-template-macroset)[ Docs](https://github.com/nedryse/latte-template-macros)[ RSS](/packages/nedryse-latte-template-macroset/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (3)Versions (2)Used By (0)

\#nedryse/latte-template-macroset (cc)# Pavel Železný (2bfree), 2014 ([pavelzelezny.cz](http://pavelzelezny.cz))

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

[](#requirements)

[Nette Framework 2.2.0](http://nette.org) or higher

Documentation
-------------

[](#documentation)

Placeholder replacement [Latte macro](http://doc.nette.org/en/2.2/default-macros) provides simple way to put the content of variables into the right places.

Macroset provides `{template ...}` macro and overwrites `{_ ...}` macro with same mechanism. First argument of these macros can contain any number of `{:placeholders}` in the string that will be replaced by the same named variables.

Replacement variables are taken from the template like `$template->placeholder`, are overwritten by local variable like `{var $placeholder}` and are overwritten by arguments of macros like `{template ..., 'placeholder' => 'replacement', ...}` or `{template ..., array('placeholder' => 'replacement', ...)}`. Replacement variables can contain `{:nested_placeholders}`, that will be replaced also.

The functionality of `{_ ...}` macro is maintained. All arguments of the macro are sended to the translator unchanged. Result of the translator will be used as template that can contain `{:placeholders}`. With this functionality you can change the possition of given arguments to provide propper number of translator plurals as the first argument of the macro.

Instalation
-----------

[](#instalation)

Prefered way to intall is by [Composer](http://getcomposer.org)

```
composer require nedryse/latte-template-macroset:~1.0.0

```

Or by manualy adding into the [composer.json](https://getcomposer.org/doc/04-schema.md#json-schema)

```
{
	"require":{
		"nedryse/latte-template-macroset": "~1.0.0"
	}
}

```

Setup
-----

[](#setup)

Add following code into the [config.neon](http://doc.nette.org/en/2.2/configuring#toc-framework-configuration)

```
common:
	extensions:
		latteTemplateMacroSet: Nedryse\Latte\Macros\TemplateMacroSetExtension

```

Usage
-----

[](#usage)

The simpliest usage is like the following code:

```
{template '{:userName}', 'userName' => $user->getIdentity()->getId()}

```

Replacement variables can be given by the array also like in the following code:

```
{var $replacements = array('userName' => $user->getIdentity()->getId())}
{template '{:userName}', $replacements}

```

Replacement variables can be given from `{var ...}` or from `$template` like in the following code:

```
{var $userName => $user->getIdentity()->getId()}
{template '{:userName}'}

```

Replacements can be overwritten in the order `$template`, `{var ...}`, `{template ..., replacements}` like in the following code:

```
{var $userName => $user->getIdentity()->getId()}
{template '{:userName}', 'userName' => 'test'}

```

Both macros also support [filters](http://doc.nette.org/en/2.2/default-filters) like in the following code:

```
{template '{:userName}', 'userName' => 'test'|upper}

```

Replacements can contain `{:nested_placeholders}` to be used as customizable template mechanism like in the following code:

```
{var $idTpl = '{:userId}'}
{var $nameTpl = '{:userName}'}
{var $pairTpl = '{:idTpl} - {:nameTpl}'}
{var $usersTpl = '{:usersListTpl}'}
{capture $usersListTpl}
	{foreach $users as $userId => $userName}
		{template $pairTpl}
	{/foreach}
{/capture}

{_'User (%s): {:usersTpl}', count($users)}

```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity58

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

4150d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/88c4f8c7289f097b6a5bc380407eac7369976484e5d071352686e764be13b8c8?d=identicon)[zeleznypa](/maintainers/zeleznypa)

---

Top Contributors

[![zeleznypa](https://avatars.githubusercontent.com/u/1191472?v=4)](https://github.com/zeleznypa "zeleznypa (1 commits)")

---

Tags

nettedrylattenedryse

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/nedryse-latte-template-macroset/health.svg)

```
[![Health](https://phpackages.com/badges/nedryse-latte-template-macroset/health.svg)](https://phpackages.com/packages/nedryse-latte-template-macroset)
```

###  Alternatives

[contributte/latte

Extra contrib to nette/latte

111.5M2](/packages/contributte-latte)[nepada/form-renderer

Latte template based form renderer for Nette forms with full support for Bootstrap 3, 4 &amp; 5.

11251.0k](/packages/nepada-form-renderer)[nextras/forms-rendering

Rendering helpers for Nette Framework Forms.

1698.4k2](/packages/nextras-forms-rendering)[pavlista/nette-palette

Palette support for Nette Framework and Latte template engine

1657.4k](/packages/pavlista-nette-palette)

PHPackages © 2026

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