PHPackages                             elmattprofe/kata - 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. elmattprofe/kata

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

elmattprofe/kata
================

Kata is a simple engine for load templates with extension \*.tpl.php

06PHP

Since Feb 12Pushed 3y ago1 watchersCompare

[ Source](https://github.com/mattprofe/kata)[ Packagist](https://packagist.org/packages/elmattprofe/kata)[ RSS](/packages/elmattprofe-kata/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Kata Component
==============

[](#kata-component)

Kata is a simple engine for load templates with extension "tpl.php".

Getting Started
---------------

[](#getting-started)

To install Kata, simply require it using Composer:

```
$ composer require elmattprofe/kata
```

PHP code for load template
--------------------------

[](#php-code-for-load-template)

index.php

```
require('../vendor/autoload.php');

use ElMattProfe\Component\Kata\Kata;

// If use a Dotenv add vars in .env
putenv('APP_VERSION=1.0');
putenv('APP_URL_BASE=localhost/kataweb/');
putenv('APP_NAME=KataWeb');

// Vars to display in the template
$vars = array(
    "SECTION" => "Welcome",
    "WEB_NAME" => getenv('APP_NAME')
);

// Template is in "resources/views//", loadView ever at the end code or block code
// $vars contains an array with variable values displaying in the template, 'dev' or 'prod' is state of code, if no define defualt is 'dev'
Kata::loadView('landing/index', $vars, 'dev');
```

Sample template
---------------

[](#sample-template)

Put in directory "resources\\views\\landing" with name "index.tpl.php"

```
>

    {{APP_NAME}}-{{SECTION}}

    {{WEB_NAME}}
    Iniciar Sesión

```

> **Note**APP\_NAME, APP\_URL\_BASE and APP\_VERSION are defined by default in the code, their values are obtained from the environment variables, therefore it is not necessary to pass their values by parameter in loadView.

Other functions includes in Kata
================================

[](#other-functions-includes-in-kata)

Extends
-------

[](#extends)

Kata can include another template within a template, this is extremely useful, it helps to simplify the code in the templates by not having to repeat common sections such as the footer, header and nav.

Place the following code in the template that will include another template

resources/views/landing/index.tpl.php

```
@extends('header')

        {{SECTION}}

@extends('footer')
```

resources/views/header.tpl.php

```
>

    {{APP_NAME}}-{{SECTION}}

```

resources/views/footer.tpl.php

```

        The web: {{APP_NAME}}

```

Yield
-----

[](#yield)

Yields are a way of creating variable code blocks within a template that will be called with extends, the content that will be replaced will be enclosed within the @section('name-yield') and @endsection('name-yield') directives.

Place the following code in the template that will include another template

resources/views/landing/index.tpl.php

```
@extends('web')

@section('content')
    {{SECTION}}
@endsection('content')

@section('footer')
    @extends('footer')
@endsection('footer')
```

resources/views/web.tpl.php

```
>

    {{APP_NAME}}-{{SECTION}}

        @yield('content')

        @yield('footer')

```

resources/views/footer.tpl.php

```
    The web: {{APP_NAME}}
```

Conditional block
-----------------

[](#conditional-block)

It depends on a variable, if it exists then the content of that block will be rendered and displayed on the screen.

resources/views/landing/index.tpl.php

```
@extends('web')

@section('content')
    @if('SECTION')
    {{SECTION}}
    @endif

    @if('DESCRIPTION')
    This website is a demonstration of the power of Kata.
    @endif
@endsection('content')

@section('footer')
    @extends('footer')
@endsection('footer')
```

Resources
---------

[](#resources)

- [Author](https://mattprofe.com.ar)

###  Health Score

14

—

LowBetter than 2% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity23

Early-stage or recently created project

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/dc0f9b64b9ad63f0cfb3e4d9757bd9d2a4f37ce68d9ad1713bd4edbd20ffa726?d=identicon)[mattprofe](/maintainers/mattprofe)

### Embed Badge

![Health badge](/badges/elmattprofe-kata/health.svg)

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

###  Alternatives

[mustache/mustache

A Mustache implementation in PHP.

3.3k44.6M291](/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)
