PHPackages                             jchook/phpp - 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. jchook/phpp

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

jchook/phpp
===========

PHP Pre-processor that enables C-like #include directives

v1.0.0-rc2(4y ago)10MITPHPPHP &gt;=7.0

Since Aug 24Pushed 4y ago1 watchersCompare

[ Source](https://github.com/jchook/php-include-directive)[ Packagist](https://packagist.org/packages/jchook/phpp)[ RSS](/packages/jchook-phpp/feed)WikiDiscussions master Synced today

READMEChangelog (2)DependenciesVersions (4)Used By (0)

PHP Preprocessor
================

[](#php-preprocessor)

Write PHP templates with `#include` directives similar to those processed by the C preprocessor.

Also optionally evaluates `` blocks.

Install
-------

[](#install)

If you want to use composer:

```
composer require-dev jchook/phpp
```

**or** [download the phar](https://github.com/jchook/php-include-directive/releases)and include it in your project

Example
-------

[](#example)

Make a file that can contain cpp-like #include directives and/or PHP templating.

**Dockerfile.in**

```
FROM alpine:3.14

#include "php.dockerfile"
#include "runit.dockerfile"
```

Then run the script to build it, similar to cpp.

```
phpp -o Dockerfile Dockerfile.in
```

Command-Line Usage
------------------

[](#command-line-usage)

```
USAGE

  phpp [options] PATH...

OPTIONS

  -h, --help  Show this help info
  -o PATH     Output processed file to PATH. (multi)
  -I PATH     Look here for included files (multi)
  --ext       Look for files with this extension (multi)
  --eval      Evaluate PHP in included files
  -v          Verbose mode

```

Options labeled (multi) can be invoked multiple times.

PHP Interface
-------------

[](#php-interface)

See the source code for more info. Here's a simple example:

```
