yakeing/php_template
yakeing/php_template is a lightweight PHP templating package for separating HTML views from application logic. It provides a straightforward way to render templates and pass data into them, making it useful for small projects or for adding simple view rendering without a full framework.
composer require yakeing/php_template — but pin the exact version ("yakeing/php_template": "1.0.x") or vendor the source, since the project is archived and last released 2019-08-08. There is no active maintainer, no security patches, and Composer updates could break you silently.README.md → src/ (the template engine class) → tests/ if present. Because the project is small (~32 stars, single-purpose), the entire source is the documentation. Grep for preg_match, preg_replace, or str_replace in the engine to understand exactly which tags are supported — don't trust the README alone.$tpl = new \Yakeing\Template\Template();
$tpl->assign('title', 'Home');
$tpl->assign('user', $user);
$tpl->assign('items', $items);
$tpl->display('index.tpl');
Confirm the constructor / directory configuration against the README — set a template directory and a compile/cache directory before the first render.display(), open the compiled output (usually a cache/ or runtime/ directory) and read the generated PHP. That file is your ground truth for how every tag compiles.View::render($file, $data)) gives you a single place to swap the engine later (Smarty, Blade, Twig) if you outgrow it.$tpl->assign($data) in a loop, or $tpl->display($file, $data) if supported) over dozens of assign() calls. It keeps controllers clean and matches how the template will actually consume the data.{include file="header.tpl"}-style tag or none at all. If includes aren't supported, build the layout in PHP: render the partial, capture the output, and inject into the layout string. Document the chosen approach in your project README — future you (or a teammate) will otherwise reinvent it.{foreach $items as $item}...{/foreach} and {if $cond}...{/if} (verify exact tags in src/). Wrap repeated table rows, cards, and nav items in loops rather than echoing HTML inside PHP foreach blocks — that's the whole point of adopting a template engine.$_GET, form input, DB text rendered as HTML), call htmlspecialchars($v, ENT_QUOTES, 'UTF-8') in the controller or escape tag ({$v|escape} if supported) in the template. Write a small helper e() and standardize on it.storage/templates_compiled/), and disable mtime checks in production if the config exposes that flag.index.php-style app: keep routing/CRUD in PHP, call the renderer only at the end. This avoids a big-bang refactor and lets you adopt the engine per-page.$this->assertStringContainsString('Hello Alice', View::render('greeting.tpl', ['name' => 'Alice'])). This catches syntax regressions when you eventually migrate off the package.app/Libraries/ directory and fix it locally. Never rely on composer update to fix anything..tpl by re-reading the raw file. Add a try/catch around render calls in dev and dump the compiled source on failure.{include}d templates — you edit header.tpl, see no change, and blame the engine. Keep a clear cache script (rm -rf storage/templates_compiled/*) and run it after every pull or template edit. Wire it into a dev-only route or Artisan-style command.www-data), not just your shell user. Symptom: blank pages or "failed to open stream" warnings. chmod -R 775 the compile dir and chown it correctly.$tpl->display($_GET['page'] . '.tpl')), you've reintroduced an LFI vector. Validate against a whitelist of known templates — this is a template engine, not a router.{$user_input} and route it through htmlspecialchars(). The engine will not save you here, and with no maintainer there will never be a security patch for an escape-related bug.{if $a=="b"} may parse where {if $a == "b"} fails (or vice versa), and nested quotes/braces in expressions can break the compiler. Keep conditions simple in templates; compute complex logic in PHP and pass a boolean.assign().View class so you can switch to Twig or Blade later without touching controllers. If the project has a multi-year lifespan, seriously consider starting with an actively maintained engine instead.How can I help you explore Laravel packages today?