PHPackages                             icanhazstring/tempa-php - 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. icanhazstring/tempa-php

ActiveLibrary

icanhazstring/tempa-php
=======================

Template file parsing library

2.2.0(3y ago)213.9k2[3 issues](https://github.com/icanhazstring/tempa-php/issues)[1 PRs](https://github.com/icanhazstring/tempa-php/pulls)1MITPHPPHP ^8.1CI passing

Since Jan 2Pushed 3mo agoCompare

[ Source](https://github.com/icanhazstring/tempa-php)[ Packagist](https://packagist.org/packages/icanhazstring/tempa-php)[ RSS](/packages/icanhazstring-tempa-php/feed)WikiDiscussions master Synced 2mo ago

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

icanhazstring/tempa-php
=======================

[](#icanhazstringtempa-php)

[![Build Status](https://camo.githubusercontent.com/4d0aa93e08748355a3c6a010eb3836dd5fff9802568833d6851917ab7ad13302/68747470733a2f2f6170692e7472617669732d63692e6f72672f6963616e68617a737472696e672f74656d70612d7068702e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/icanhazstring/tempa-php)

What for?
---------

[](#what-for)

You all came across some `*.dist` or `*.skel` files of some sort. This library can be used to replace every existing substitute in those files as well as simply list them.

Install
-------

[](#install)

To install this library simply use composer.

```
$ composer require icanhazstring/tempa-php
```

After you have done this you need to create a `tempa.json` file inside you project. This file holds some basic information about the template files.

Here is an example

```
{
  "fileExtensions": ["dist", "skel"],
  "prefix": "{$",
  "suffix": "}"
}
```

Usage
-----

[](#usage)

### Scan

[](#scan)

You can scan a directory or single file using the scan command.

```
$ vendor/bin/tempa file:scan  []
```

You can deliver every other config you want. By default the script will take the `tempa.json` from the location you executed the script.

```
$ vendor/bin/tempa file:scan test/Demo
$ vendor/bin/tempa file:scan test/Demo test/Demo/tempa.json

Scanning for template files in: /home/icanhazstring/tempa-php/test/Demo
=======================================================================

 2/2 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%

/home/ando/tempa-php/test/Demo/Sub/test.php.dist
------------------------------------------------

Line 3 : 'database' => '{$database}',
Line 4 : 'username' => '{$user}'

/home/ando/tempa-php/test/Demo/test.php.dist
--------------------------------------------

Line 3 : 'placeholder' => '{$superAwesome}'
```

### Substitute

[](#substitute)

To replace stuff run the following:

```
$ vendor/bin/tempa file:substitute [-f|--mapfile [MAPFILE]] [--]  [] []...
```

```
$ vendor/bin/tempa file:substitute test/Demo/
$ vendor/bin/tempa file:substitute test/Demo/ --mapfile=test/Demo/maps/map.[json|php]
$ vendor/bin/tempa file:substitute test/Demo/ test/Demo/tempa.json database=localhost user=icanhazstring superAwesome=mega

Processing template files in: /home/icanhazstring/tempa-php/test/Demo
=====================================================================

 2/2 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
```

### Interactive

[](#interactive)

You can replace every with an interactive mode:

```
$ vendor/bin/tempa file:interactive test/Demo
$ vendor/bin/tempa file:interactive test/Demo test/Demo/tempa.json

Interactive substitution for template files in: /home/icanhazstring/tempa-php/test/Demo
=======================================================================================

Found 3 substitutes
-------------------

database:
>

...
```

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance34

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity78

Established project with proven stability

 Bus Factor1

Top contributor holds 92.9% 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 ~280 days

Recently: every ~558 days

Total

9

Last Release

1179d ago

Major Versions

1.1.2 → 2.0.02017-08-14

PHP version history (2 changes)2.0.0PHP ~7.1

2.2.0PHP ^8.1

### Community

Maintainers

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

---

Top Contributors

[![icanhazstring](https://avatars.githubusercontent.com/u/883543?v=4)](https://github.com/icanhazstring "icanhazstring (26 commits)")[![demichl68](https://avatars.githubusercontent.com/u/4621362?v=4)](https://github.com/demichl68 "demichl68 (1 commits)")[![teewurst](https://avatars.githubusercontent.com/u/7197260?v=4)](https://github.com/teewurst "teewurst (1 commits)")

---

Tags

phpsubstitutetempa-phptemplate

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/icanhazstring-tempa-php/health.svg)

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

###  Alternatives

[phan/phan

A static analyzer for PHP

5.6k11.2M1.1k](/packages/phan-phan)[illuminate/console

The Illuminate Console package.

12944.1M5.1k](/packages/illuminate-console)[php-soap/wsdl

Deals with WSDLs

173.5M12](/packages/php-soap-wsdl)[php-soap/wsdl-reader

A WSDL reader in PHP

212.3M9](/packages/php-soap-wsdl-reader)[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)
