PHPackages                             kanata-php/mustachio - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. kanata-php/mustachio

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

kanata-php/mustachio
====================

Stubs processor.

0.0.2(3y ago)0218↓100%PHP

Since Nov 13Pushed 3y ago1 watchersCompare

[ Source](https://github.com/kanata-php/mustachio)[ Packagist](https://packagist.org/packages/kanata-php/mustachio)[ GitHub Sponsors](https://github.com/kanata-php)[ RSS](/packages/kanata-php-mustachio/feed)WikiDiscussions master Synced today

READMEChangelog (2)Dependencies (3)Versions (3)Used By (0)

[![](./imgs/mustachio.svg)](./imgs/mustachio.svg)

[![Tests](https://github.com/kanata-php/mustachio/actions/workflows/php.yml/badge.svg)](https://github.com/kanata-php/mustachio/actions/workflows/php.yml)[ ![](https://camo.githubusercontent.com/a83b3eec1443b82ec61103fe4a2a7587f843bf3c2dcd7f688edb0673a7134f01/68747470733a2f2f636f6465636f762e696f2f67682f6b616e6174612d7068702f6d757374616368696f2f6272616e63682f6d61737465722f67726170682f62616467652e7376673f746f6b656e3d5439304759465257505a) ](https://codecov.io/gh/kanata-php/mustachio)

Mustachio
=========

[](#mustachio)

This lib parse some template or stub. You can use it as a PHP [terminal command](#cli-phar-usage) or in your [code](#code-usage).

Kudos to [Mustache](https://github.com/bobthecow/mustache.php)!

Install
-------

[](#install)

### CLI

[](#cli)

To use as a CLI command, you can download the phar file:

> **Important:** remember to replace the `version-number`!

- [https://github.com/kanata-php/mustachio/releases/download/{version-number}/stache](https://github.com/kanata-php/mustachio/releases/download/%7Bversion-number%7D/stache) .

### Library

[](#library)

Install via composer:

```
composer require kanata-php/mustachio
```

Usage
-----

[](#usage)

### App Service

[](#app-service)

#### Stub Parser

[](#stub-parser)

This can serve as a file stub parser or a very simple template engine. By default, it uses [mustache](https://github.com/bobthecow/mustache.php) to parse the input file.

```
use Mustachio\Service as Stache;
$parsedContent = Stache::parse('my content with {{PLACEHOLDER}}', ['PLACEHOLDER' => 'value']);
// output: my content with value
```

#### Line Replacement

[](#line-replacement)

This can be used to replace/remove lines in files.

```
use Mustachio\Service as Stache;
Stache::replaceFileLineByCondition(
    file: '/path/to/file',
    conditions: [
        fn($l) => strpos($l, 'identifier-1') !== false,
        fn($l) => strpos($l, 'identifier-2') !== false,
    ],
    values: [
        'replacement-for-identifier-1',
        'replacement-for-identifier-2',
    ],
    toRemove: function ($l) {
        return strpos($l, 'identifier-to-remove') !== false;
    },
);
// output: update the original file
```

### Cli Phar Usage

[](#cli-phar-usage)

#### Stub Parser

[](#stub-parser-1)

This can process input files giving back the output file parsed with the given placeholders.

```
php bin/stache "/path/to/my.stub" "/path/to/my.php" "PLACEHOLDER:value;PLACEHOLDER2:value2"
```

Tests
-----

[](#tests)

```
vendor/bin/pest
```

###  Health Score

21

—

LowBetter than 20% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity37

Early-stage or recently created project

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

Total

2

Last Release

1220d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/90c2bdf7a2fb985ab0c72c842c4f7cbff79cb172deb85c06edf0bedceb3c9498?d=identicon)[lotharthesavior](/maintainers/lotharthesavior)

---

Top Contributors

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

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/kanata-php-mustachio/health.svg)

```
[![Health](https://phpackages.com/badges/kanata-php-mustachio/health.svg)](https://phpackages.com/packages/kanata-php-mustachio)
```

###  Alternatives

[helhum/typo3-config-handling

Simple but powerful configuration handling for TYPO3 CMS

38304.9k4](/packages/helhum-typo3-config-handling)[bonndan/release-manager

Release Manager for semantic version releases of composer packages and projects.

2619.2k](/packages/bonndan-release-manager)[lexik/cron-file-generator-bundle

This bundle provides service for generate cron file

235.8k](/packages/lexik-cron-file-generator-bundle)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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