phrep

Update of "phrep"
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview

Artifact ID: 22491662b8cc2d5689c0c68b0bb4c0cbd8e2f36a
Page Name:phrep
Date: 2015-05-29 12:56:54
Original User: mario
Mimetype:text/x-markdown
Parent: 761bb8fe7d0ca4c12480b805f29febe050cbe507
Content

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