ngyuki / ephp
ephp is php template
Installs: 10
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/ngyuki/ephp
Requires
- php: ^7.2
- microsoft/tolerant-php-parser: ^0.0.18
Requires (Dev)
- mikey179/vfsstream: ^1.6
This package is auto-updated.
Last update: 2025-10-10 15:32:15 UTC
README
ephp is pure plain php template with support auto escape.
Example
<!-- index.phtml --> <strong><?= strtoupper($name) ?></strong>
Use StreamFilter
(for development).
<?php $filter = new StreamFilter(); (function ($filename, $variables) use ($filter) { extract($variables, EXTR_SKIP); require $filter->path($filename); //=> <strong>A & B</strong> })('index.phtml', ['name' => 'a & b']);
Use Compiler
(for production).
<?php $sourceDir = __DIR__; $compiledDir = __DIR__ . '/compiled'; $compiler = new Compiler($sourceDir, $compiledDir); (function ($filename, $variables) use ($compiler) { extract($variables, EXTR_SKIP); require $compiler->compile($filename); //=> <strong>A & B</strong> })('index.phtml', ['name' => 'a & b']);