PHPackages                             vitkovskii/jte - 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. vitkovskii/jte

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

vitkovskii/jte
==============

Fast and flexible template engine

0.1.0(12y ago)115[2 issues](https://github.com/vitkovskii/jte/issues)MITPHP

Since Jan 9Pushed 12y agoCompare

[ Source](https://github.com/vitkovskii/jte)[ Packagist](https://packagist.org/packages/vitkovskii/jte)[ RSS](/packages/vitkovskii-jte/feed)WikiDiscussions master Synced 1mo ago

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

Jedi template engine
====================

[](#jedi-template-engine)

Fast and flexible template engine

See [example](https://github.com/vitkovskii/jte/tree/master/examples)

Use composer to install

Main features
-------------

[](#main-features)

- Separated markup and logic
- Template inheritance
- Super fast and simple
- No dependencies

Basic usage
-----------

[](#basic-usage)

```
$jte = new Jte(__DIR__ . '/templates', ['useCache' => true, 'dir' => __DIR__ . '/cache/']);

echo $jte->render('template.jte', 'main', ['param1' => 'value1', 'param2' => 'value2']);

```

Template syntax
---------------

[](#template-syntax)

Template consists of sections. There are three section types:

- Boot section
- Block markup section
- Block logic section

### Boot section

[](#boot-section)

This section is executed then template is booting. Body of the section is pure PHP code.

If you want template extends another, you can specify it in this section:

```
boot {
    extend('base.jte');
}

```

Dynamic inheritance:

```
boot {
    extend(param('parent'));
}

```

More complex:

```
boot {
    if (param('some') % 2 == 0) {
        extend('foo.jte');
    } else {
        extend('baz.jte');
    }
}

```

### Block markup section

[](#block-markup-section)

Block is an independent chunk of HTML or something else :)

```
markup some_block_name {

}

```

You can include references to another blocks into block:

```
markup some_block_name {

            [[ body_block ]]

}

```

Also you can include tree of blocks:

```
markup some_block_name {

            [[ body_block ]] {{

                    [[ menu_block ]]

                    [[ footer_block ]]

            }}

}

```

If you want to include passed param into template do this:

```
markup footer {

        User count: [[ user_count_block = user_count_param ]]

}

```

Or anonymous variant:

```
markup footer {

        User count: [[ =user_count_param ]]

}

```

### Block logic section

[](#block-logic-section)

With this block you can dynamically generate block contents from params or another blocks. Body of this block is pure PHP code.

Replace block with passed param:

```
markup footer {

        User count: [[ user_count_block ]]

}

logic footer {
    replace('user_count_block')->with(param('user_count'));
}

```

Replace block with another block:

```
markup item {
    Foo :)
}

markup footer {

        [[ footer_content ]]

}

logic footer {
    replace('footer_content')->with(block('item'));
}

```

Replace block with iterator:

```
markup item {
    Foo :) [[ =count ]]
}

markup footer {

        [[ footer_content ]]

}

logic footer {
    replace('footer_content')->with(iterator([1, 2, 3], function($item, $count) {
        return block('item', ['count' => $count]);
    }));
}

```

Self replacement:

```
logic menu {
    replace('menu_items')->with(iterator(param('menu'), function($item, $count) {
        if ($count % 2 == 1) {
            $class = 'bg-1';
        } else {
            $class = 'bg-2';
        }

        $item['class'] = $class;

        return self($item);
    }));
}

markup menu {

        [[ menu_items ]] {{
            [[ =name ]]
        }}

}

```

To do
-----

[](#to-do)

- Add documentation for template inheritance mechanism
- Add more examples

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity53

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

4503d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1587d6294373f1a9b299e7617d4b2f9824b6ea25ff3e095e5008383940188f45?d=identicon)[vitkovskii](/maintainers/vitkovskii)

---

Top Contributors

[![vitkovskii](https://avatars.githubusercontent.com/u/2269880?v=4)](https://github.com/vitkovskii "vitkovskii (5 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/vitkovskii-jte/health.svg)

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

###  Alternatives

[mustache/mustache

A Mustache implementation in PHP.

3.3k44.6M290](/packages/mustache-mustache)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)[whitecube/nova-flexible-content

Flexible Content &amp; Repeater Fields for Laravel Nova.

8053.0M25](/packages/whitecube-nova-flexible-content)[mopa/bootstrap-bundle

Easy integration of twitters bootstrap into symfony2

7042.9M33](/packages/mopa-bootstrap-bundle)[limenius/react-bundle

Client and Server-side react rendering in a Symfony Bundle

3871.2M](/packages/limenius-react-bundle)[nicmart/string-template

StringTemplate is a very simple string template engine for php. I've written it to have a thing like sprintf, but with named and nested substutions.

2101.7M30](/packages/nicmart-string-template)

PHPackages © 2026

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