PHPackages                             aleskafka/component-macro - 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. aleskafka/component-macro

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

aleskafka/component-macro
=========================

Extends Latte with simple component model

0.1(11y ago)5121MITPHP

Since Apr 19Pushed 10y ago2 watchersCompare

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

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

component-macro
===============

[](#component-macro)

Extends Latte with simple component model inspired by JSX for React

### Installation

[](#installation)

Use composer:

```
$ composer require aleskafka/component-macro
```

Install in configuration file to Latte Engine:

```
$latte = new Latte\Engine;
ComponentMacro::install($latte, __DIR__ . '/components');
```

### Basic example

[](#basic-example)

Create Header component as latte template in `__DIR__ . '/components/header.latte`

```
{default title=>'', subtitle=>'', follow=>NULL}
{$title}{$subtitle}
  {if $follow}
   followed
  {else if $follow!==NULL}
   follow
  {/if}

```

In arbitrary page template render Header component with specific arguments.

```

```

### Features

[](#features)

For more example see tests. In short you can:

- render components in React style
- You can use variable $\_html in component. It contains body rendered in parent template inside component tags
- You can expand variable into component ``
- You can expand defined variables into component ``
- You can name elements/components inside component with macro n:key="string" (keys can be dynamic) and override it inside parental component tags:

```

  Override span[string] subcomponent

```

### License

[](#license)

MIT. See full [license](license.md).

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community8

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

4048d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9fb663b50d0d2c755a846c09e2fd2c2ee90d6f58f35940b3331e1790338db275?d=identicon)[aleskafka](/maintainers/aleskafka)

---

Top Contributors

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

---

Tags

templatingcomponentlattemacro

### Embed Badge

![Health badge](/badges/aleskafka-component-macro/health.svg)

```
[![Health](https://phpackages.com/badges/aleskafka-component-macro/health.svg)](https://phpackages.com/packages/aleskafka-component-macro)
```

###  Alternatives

[twig/twig

Twig, the flexible, fast, and secure template language for PHP

8.4k443.2M5.8k](/packages/twig-twig)[mustache/mustache

A Mustache implementation in PHP.

3.3k44.6M291](/packages/mustache-mustache)[smarty/smarty

Smarty - the compiling PHP template engine

2.3k39.1M395](/packages/smarty-smarty)[laminas/laminas-view

Fast and type safe HTML templating library with a flexible plugin system supporting multistep template composition

7526.3M230](/packages/laminas-laminas-view)

PHPackages © 2026

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