PHPackages                             phalette/platte - 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. phalette/platte

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

phalette/platte
===============

Nette Latte template adapter for Phalcon

0.2(10y ago)757.2k1BSD-3-ClausePHPPHP &gt;= 5.6.0

Since Sep 15Pushed 5mo ago2 watchersCompare

[ Source](https://github.com/contributte/platte)[ Packagist](https://packagist.org/packages/phalette/platte)[ Docs](https://github.com/phalette/ph-latte)[ Fund](https://contributte.org/partners.html)[ GitHub Sponsors](https://github.com/f3l1x)[ RSS](/packages/phalette-platte/feed)WikiDiscussions master Synced 1mo ago

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

[![](https://camo.githubusercontent.com/2d544ec2cab9a68e78bd59c5cc5d3996f8849ef91c2ffd4653305fda8bb4e886/68747470733a2f2f686561746261646765722e76657263656c2e6170702f6769746875622f726561646d652f636f6e74726962757474652f706c617474652f3f646570726563617465643d31)](https://camo.githubusercontent.com/2d544ec2cab9a68e78bd59c5cc5d3996f8849ef91c2ffd4653305fda8bb4e886/68747470733a2f2f686561746261646765722e76657263656c2e6170702f6769746875622f726561646d652f636f6e74726962757474652f706c617474652f3f646570726563617465643d31)

 [![](https://camo.githubusercontent.com/a8b1cd856d7d396fdebbe46947cc3507490acc267a02361e5e53bb7b820c95c3/68747470733a2f2f62616467656e2e6e65742f62616467652f737570706f72742f6769747465722f6379616e)](https://bit.ly/ctteg) [![](https://camo.githubusercontent.com/86d6416fc04f8bcc3daa7bf881526b9953b9726b1164d05c157c8713e3a73418/68747470733a2f2f62616467656e2e6e65742f62616467652f737570706f72742f666f72756d2f79656c6c6f77)](https://bit.ly/cttfo) [![](https://camo.githubusercontent.com/5d170ab94e6d594609561e16fe0f9e4293968fbd4dfcfafc5e11efc1415ef09c/68747470733a2f2f62616467656e2e6e65742f62616467652f73706f6e736f722f646f6e6174696f6e732f463936383534)](https://contributte.org/partners.html)

 Website 🚀 [contributte.org](https://contributte.org) | Contact 👨🏻‍💻 [f3l1x.io](https://f3l1x.io) | Twitter 🐦 [@contributte](https://twitter.com/contributte)

Disclaimer
----------

[](#disclaimer)

⚠️This project is no longer being maintained.Composer[`phalette/platte`](https://packagist.org/packages/phalette/platte)Version[![](https://camo.githubusercontent.com/02f4799fcbbe587f4ac85cf4bea0d4fd8019e72d9dca86f917aadd4cacba2993/68747470733a2f2f62616467656e2e6e65742f7061636b61676973742f762f7068616c657474652f706c61747465)](https://camo.githubusercontent.com/02f4799fcbbe587f4ac85cf4bea0d4fd8019e72d9dca86f917aadd4cacba2993/68747470733a2f2f62616467656e2e6e65742f7061636b61676973742f762f7068616c657474652f706c61747465)PHP[![](https://camo.githubusercontent.com/8333dfb66518c334353ef0f3aa38bb3547733f907fb1a9348e49992b325a6728/68747470733a2f2f62616467656e2e6e65742f7061636b61676973742f7068702f7068616c657474652f706c61747465)](https://camo.githubusercontent.com/8333dfb66518c334353ef0f3aa38bb3547733f907fb1a9348e49992b325a6728/68747470733a2f2f62616467656e2e6e65742f7061636b61676973742f7068702f7068616c657474652f706c61747465)License[![](https://camo.githubusercontent.com/c808d58ac66c760cc59fa686361a98e66e36d6715717c1dadf2c367a0327a420/68747470733a2f2f62616467656e2e6e65742f6769746875622f6c6963656e73652f636f6e74726962757474652f706c61747465)](https://camo.githubusercontent.com/c808d58ac66c760cc59fa686361a98e66e36d6715717c1dadf2c367a0327a420/68747470733a2f2f62616467656e2e6e65742f6769746875622f6c6963656e73652f636f6e74726962757474652f706c61747465)About
-----

[](#about)

Combination of one of the best template engine Latte and pretty fast framework Phalcon.

Install
-------

[](#install)

```
$ composer require phalette/platte:dev-master
```

### Dependencies

[](#dependencies)

- **PHP &gt;= 5.5.0**
- [Latte &gt;= 2.3.0](https://github.com/nette/latte)
- [Phalcon &gt;= 2.0.0](https://github.com/phalcon/cphalcon/)

Configuration
-------------

[](#configuration)

Register Platte as your next `template engine`.

```
use Phalette\Platte\Latte\LatteFactory;
use Phalette\Platte\LatteTemplateAdapter;

$di->set('view', function () {
    $view = new View();

    $view->registerEngines([
        ".latte" => function ($view, $di) {
            $factory = new LatteFactory();
            $factory->setTempDir(__DIR__ . '/cache');
            return new LatteTemplateAdapter($view, $di, $factory);
        },
    ]);
    return $view;
});
```

Features from Phalcon
---------------------

[](#features-from-phalcon)

You can access variables in templates.

Variables`$_view`[Phalcon\\Mvc\\View](https//docs.phalconphp.com/en/latest/api/Phalcon_Mvc_View.html)`$_tag`[Phalcon\\Tag](https//docs.phalconphp.com/en/latest/api/Phalcon_Tag.html)`$_url`[Phalcon\\Mvc\\Url](https//docs.phalconphp.com/en/latest/api/Phalcon_Mvc_Url.html)`$_security`[Phalcon\\Security](https//docs.phalconphp.com/en/latest/api/Phalcon_Security.html)In extreme cases you can access **$\_di**. But I really not recommend it.

### Macros

[](#macros)

Files &amp; contents`{content}``$_view->getContent()``{partial}``$_view->getPartial($path)`Links &amp; urls`{linkTo}``$_tag->linkTo($args...)``{url}``$_url->get($uri)`Forms`{textField}``$_tag->textField($args)``{passwordField}``$_tag->passwordField($args)``{hiddenField}``$_tag->hiddenField($args)``{fileField}``$_tag->fileField($args)``{radioField}``$_tag->radioField($args)``{submitButton}``$_tag->submitButton($args)``{selectStatic}``$_tag->selectStatic($args...)``{select}``$_tag->select($args...)``{textArea}``$_tag->textArea($args)``{form}``$_tag->form($args)``{endForm}``$_tag->endForm()`Other`{title}``$_tag->getTitle()``{friendlyTitle}``$_tag->friendlyTitle($args...)``{doctype}``$_tag->getDocType()`Assets`{stylesheetLink}``$_tag->stylesheetLink($args...)``{css}``$_tag->javascriptInclude($args...)``{javascriptInclude}``$_tag->javascriptInclude($args...)``{js}``$_tag->javascriptInclude($args...)``{image}``$_tag->image($args)`Security`{securityToken}``$_security->getToken()``{securityTokenKey}``$_security->getTokenKey()`Features from Nette
-------------------

[](#features-from-nette)

You can use all the great features from the Latte.

### Latte Template Engine

[](#latte-template-engine)

See more on [official documentation](https://doc.nette.org/en/2.3/templating).

You can use **macros** and **filters**.

#### Macros

[](#macros-1)

Classic macros

```

    {foreach $users as $user}
        {$user->name}
    {/foreach}

```

N-macros

```

    {$user->name}

```

#### Filters

[](#filters)

```
{var $time => time()}
It's {$time|date:'d.m.Y'} at {$time|date:'H:i:s'}
```

### Latte Macros

[](#latte-macros)

See more on [official documentation](https://doc.nette.org/en/2.3/default-macros).

Variable and expression printing`{$variable}`prints an escaped variable`{$variablenoescape}``{expression}`prints an escaped expression`{expressionnoescape}`Conditions`{if $cond} … {elseif $cond} … {else} … {/if}`if condition`{ifset $var} … {elseifset $var} … {/ifset}`if (isset()) conditionLoops`{foreach $arr as $item} … {/foreach}`foreach loop`{for expr; expr; expr} … {/for}`for loop`{while expr} … {/while}`while loop`{continueIf $cond}`conditional jump to the next iteration`{breakIf $cond}`conditional loop break`{first} … {/first}`prints if first iteration`{last} … {/last}`prints if last iteration`{sep} … {/sep}`separatorVariables`{var $foo = value}`variable creation`{default $foo = value}`default value when variable isn't declared`{capture $var} … {/capture}`captures a section to a variableEngine`{include 'file.latte'}`includes a template from other file`{cache $key} … {/cache}`caches a template section`{php expression}`evaluates an expression without printing it`{* comment text *}`a comment (removed from evaluation)`{syntax mode}`switches the syntax at runtime`{use Class}`loads new user-defined macros`{l} or {r}`prints { and } characters, respectively`{contentType $type}`switches the escaping mode and sends HTTP header`{status $code}`sets an HTTP status codeHTML tag attributes`n:class`smart class attribute`n:attr`smart HTML attributes`n:ifcontent`Omit empty HTML tag`n:tag-if`Omit HTML tag if condition is FALSETranslations`{_}Text{/_}`translates a text`{_expression}`translates an expression and prints it with escapingBlocks, layouts, template inheritance`{block block}`block definition and immediate print out`{define block}`block defintion for future use`{include block}`inserts a block`{include mytemplate.latte}`inserts a template`{includeblock 'file.latte'}`loads blocks from external template`{layout 'file.latte'}`specifies a layout file`{extends 'file.latte'}`alias for {layout}`{ifset #block} … {/ifset}`condition if block is defined### Latte Filters

[](#latte-filters)

See more on [official documentation](https://doc.nette.org/en/2.3/default-filters).

String modification`truncate (length, append = '..')`shortens the length preserving whole words`substr (offset [, length])`returns part of the string`trim (charset = whitespace)`strips whitespace or other characters from the beginning and end of the string`striptags`removes HTML tags`strip`removes whitespace`webalize (charlist = '...', lower = TRUE)`returns string in cool URL form`toAscii`removes accents`indent (level = 1, char = "\t"")"`indents the text from left with number of tabs`replace (search, replace = '')`replaces all occurrences of the search string with the replacement`replaceRE (pattern, replace = '')`replaces all occurrences according to regular expression`padLeft (length, pad = ' ')`completes the string to given length from left`padRight (length, pad = ' ')`completes the string to given length from right`repeat (count)`repeats the string`implode (glue = '')`joins an array to a string`nl2br`new lines with
Letter casing`lower`makes a string lower case`upper`makes a string upper case`firstUpper`makes the first letter upper case`capitalize`lower case, the first letter of each word upper caseFormatting`date (format)`formats date`number (decimals = 0, decPoint = '.')`format number`bytes (precision = 2)`formats size in bytesOther`noescape`prints a variable without escaping`dataStream (mimetype = detect)`Data URI protocol conversion`escapeurl`escapes parameter in URL`length`returns length of a string`null`flushes the input, returns nothingFeatures from your own
----------------------

[](#features-from-your-own)

### Writing macros

[](#writing-macros)

1. Define macros

```
use Latte\Compiler;
use Latte\Macros\MacroSet;
use Phalette\Platte\Latte\MacroInstaller;

final class MyUltraMacros extends MacroSet implements MacroInstaller
{
    public static function install(Compiler $compiler)
    {
        $me = new static($compiler);

        $me->addMacro(...);
    }
}
```

2. Register to `LatteFatory`

```
$factory = new LatteFactory();
$factory->addMacro(new MyUltraMacros);
```

### Writing filters

[](#writing-filters)

1. Define filters

```
final class MyUltraFilters
{
    public static function hi($name)
    {
        return "Hi $name";
    }
}
```

2. Register to `LatteFatory`

```
$factory = new LatteFactory();
$factory->addFilter('sayhi', ['MyUltraFilters', 'hi']);
```

Development
-----------

[](#development)

This package was maintained by these authors.

[ ![](https://avatars2.githubusercontent.com/u/538058?v=3&s=80)](https://github.com/f3l1x)---

Consider to [support](https://contributte.org/partners.html) **contributte** development team. Also thank you for using this package.

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance49

Moderate activity, may be stable

Popularity28

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity49

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

Total

2

Last Release

3898d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/538058?v=4)[Milan Šulc](/maintainers/f3l1x)[@f3l1x](https://github.com/f3l1x)

---

Top Contributors

[![f3l1x](https://avatars.githubusercontent.com/u/538058?v=4)](https://github.com/f3l1x "f3l1x (19 commits)")

---

Tags

lattelatte-template-enginemacrosphalcontwignettetemplatingphalconenginelatte

### Embed Badge

![Health badge](/badges/phalette-platte/health.svg)

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

###  Alternatives

[latte/latte

☕ Latte: the intuitive and fast template engine for those who want the most secure PHP sites. Introduces context-sensitive escaping.

1.3k15.7M683](/packages/latte-latte)[timber/timber

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

5.7k3.4M111](/packages/timber-timber)[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)

PHPackages © 2026

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