PHPackages                             lkt/templates - 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. lkt/templates

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

lkt/templates
=============

LKT PHP Template

2.0.1(3y ago)02261MITPHPPHP &gt;=8.1.0

Since Jan 31Pushed 3y ago1 watchersCompare

[ Source](https://github.com/lkt-php/lkt-templates)[ Packagist](https://packagist.org/packages/lkt/templates)[ RSS](/packages/lkt-templates/feed)WikiDiscussions v1.2 Synced 3w ago

READMEChangelog (4)Dependencies (3)Versions (11)Used By (1)

LKT Templates
=============

[](#lkt-templates)

It's simple. It's fast. It's LKT Templates!

Are you tired of complex PHP template engine?

Would you like to code just like in regular PHP?

Then this lib is for you!

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

[](#installation)

```
composer require lkt/templates
```

Usage
-----

[](#usage)

### The layout file

[](#the-layout-file)

LKT Templates works with PHTML/PHP files.

In a PHTML file you can do anything you can do with PHP, just remember the colon syntax.

For example, take this `layout.phtml` file:

```

    Favourite drink:

```

You may be asking where the data came from? That's what follows

### The Template instance: Access to the layout

[](#the-template-instance-access-to-the-layout)

This is how you access to `layout.phtml`:

```
use Lkt\Templates\Template;

// Create a template instance:
$template = Template::file('layout.phtml'); // You can set a relative path, but absolute path it's allowed too

// Feed the data
$template->setData([
    'title' => 'Hello from LKT Templates!',
    'data' => [1,2]
]);

// If you want to, you can add more data with:
$template->set('favouriteDrink', 'Apple juice'); // PEGI 3+ example

// Parse the layout
$html = $template->parse(); // String returned

// And now you can just print the html or do whatever you want to do with that string
echo $html;

// Alternatively, you can just print the template, and it will be automatically parsed:
echo $template; // equal to echo $template->parse();
```

### The generated HTML

[](#the-generated-html)

The layout used in this readme feed with data as shown in the PHP example will print something like this:

```
Hello from LKT Templates!
1
2
Favourite drink: Apple juice
```

Additional notes
----------------

[](#additional-notes)

### Access a template file with constant path:

[](#access-a-template-file-with-constant-path)

```
$template = Template::file(__DIR__ . '/path/to/layout.phtml');
```

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity72

Established project with proven stability

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

Recently: every ~10 days

Total

10

Last Release

1279d ago

Major Versions

v1.2.x-dev → 2.0.02022-12-22

PHP version history (2 changes)1.0.0PHP &gt;=7.2.0

2.0.0PHP &gt;=8.1.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/456537?v=4)[Gediminas Aleknavičius](/maintainers/lkt)[@lkt](https://github.com/lkt)

---

Top Contributors

[![alphaibanez](https://avatars.githubusercontent.com/u/24976472?v=4)](https://github.com/alphaibanez "alphaibanez (8 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/lkt-templates/health.svg)

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

###  Alternatives

[limenius/react-bundle

Client and Server-side react rendering in a Symfony Bundle

3861.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.

291.8k](/packages/webkinder-sproutset)[awkwardideas/switchblade

Extended blade directives for laravel

102.1k](/packages/awkwardideas-switchblade)

PHPackages © 2026

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