phrep

phrep
Login

PHP Macro Preprocessor

phrep is a command-line macro preprocessor for PHP code.

It's intended as static configuration tool...

Usage

Preprocessing a source script is as simple as:

 phrep -i config.src -o config.php -D PKG_USE_SQLITE=1

Where source files might look (well, in complex cases) like this:

 <?php
 #if __PHP_VERSION__ >= 5.4 && defined(PKG_USE_SQLITE)
  #pragma(dirs=./includes)
  #include <sqlite.ph>
 #else
     include("./lib/basic_db.php");
  #ifdef PKG_DB_EXTENSION
     $db->option = PKG_DB_EXTENSION;
  #endif
 #endif

Most preprocessor constants are just meant for conditional sectioning. But they can also be substituted in PHP code blocks. Just like macros such as HTML@(<a link="$var">…) or even PARAMETERIZE@(select :$x FROM y WHERE z=$z).

Status

Download

<style> .download { background: linear-gradient(180deg, #66DD55, #448822); border: 1px solid #449933; color: #FFFFFF; text-shadow: 0px 1px 0px #888888; border-radius: 5px; font-weight: 500; font-size: 115%; margin: 2pt; padding: 2pt 5pt; } </style>