PHPackages                             abbeycat/prepro - 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. abbeycat/prepro

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

abbeycat/prepro
===============

A tool to preprocess source files

1.0.1(8y ago)035MITPHP

Since Apr 14Pushed 8y agoCompare

[ Source](https://github.com/abbeycatuk/prepro)[ Packagist](https://packagist.org/packages/abbeycat/prepro)[ RSS](/packages/abbeycat-prepro/feed)WikiDiscussions master Synced 2d ago

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

prepro
======

[](#prepro)

prepro is a simple preprocessor, allowing for a set of centralised constant definitions to be substituted into a project's source files.

Code Example
------------

[](#code-example)

prepro requires two configuration files before it can be invoked - a definitions file, and a configuration file.

### Definitions

[](#definitions)

The definitions follows essentially a C-like syntax and identifies all constants (one per line) that prepro is to consider during preprocessing.

The example below identifies a definitions file (prepro.def) that associates the constant "MAX\_USERNAME\_LENGTH" with the value "20":

```
; define an example constant
#define MAX_USERNAME_LENGTH 20

```

### Configuration

[](#configuration)

The configuration file provides a simple mapping that tells prepro which file types it should look for, and what affix each constant will be surrounded by.

The example below identifies a configuration file (prepro.ini) that implies prepro should only consider .php, .phtml, .js and .ini files for preprocessing, and that constants identified in prepro.def will be found with "\_\_" affixes (i.e. "MAX\_USERNAME\_LENGTH" will be "\_*MAX\_USERNAME\_LENGTH*\_"):

```
[mappings]
php,phtml,js,ini = "__"

```

With the definitions and configuration available, prepro can be invoked against a source folder and told to output the preprocessed results into an output folder like this:

```
$ prepro --input pre --output source --config prepro.ini --preprocess prepro.def
```

Motivation
----------

[](#motivation)

Some projects gather various technologies, frameworks and languages that operate across various layers. In these projects, certain constants can end up being defined repeatedly throughout, and changing them requires diligence to ensure all references have been captured and changed correctly.

prepro moves to allow for a central definition of such constants, and to have these substituted at the source level (prior to any existing build process), helping to ensure that a change to a definition can be quickly, correctly and reliably propagated throughout the project.

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

[](#installation)

It is simplest to use [Composer](https://getcomposer.org/) to download and install prepro.

License
-------

[](#license)

This project is licensed under MIT. See the LICENSE file for more details.

Contribute
----------

[](#contribute)

Contributions, whatever their nature, are welcomed.

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity64

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

Total

2

Last Release

3277d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/12751761?v=4)[abbeycat](/maintainers/abbeycat)[@abbeycat](https://github.com/abbeycat)

---

Top Contributors

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

---

Tags

preprocessor

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/abbeycat-prepro/health.svg)

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

###  Alternatives

[css-crush/css-crush

CSS preprocessor

545321.1k13](/packages/css-crush-css-crush)

PHPackages © 2026

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