topthink/think-template
A lightweight PHP template engine for ThinkPHP that compiles templates into plain PHP. It supports template inheritance, includes, variable output, custom tags and caching, making view rendering fast, simple and easy to integrate into existing applications.
topthink/think-template is the standalone extraction of the ThinkPHP view engine. If any part of the roadmap involves inheriting, integrating with, or migrating off ThinkPHP, this is the compatibility seam and should be explicitly owned rather than discovered late.Adopt when:
{$var}, {volist}, tag libraries) with no Node build step, deployable to constrained shared hosting or legacy PHP-FPM environments.Look elsewhere when:
twig/twig, jenssegers/blade, or platesphp/plates (PHP-native but with a modern, actively maintained ecosystem).To executives: This is a free, Apache-2.0-licensed PHP templating engine extracted from the widely deployed ThinkPHP framework. It lets us ship server-rendered screens and transactional documents without adding a JavaScript build pipeline or a paid dependency, and it compiles templates to plain PHP so production performance is predictable under OPcache. The licensing and dependency footprint are clean, so legal and security review should be fast. The tradeoff is community size: it is a narrow, vendor-maintained tool rather than a broad ecosystem standard, so we should adopt it deliberately on specific surfaces, not as an org-wide mandate.
To engineering: It gives you PHP-native template syntax, layout/inheritance, tag libraries, and a compile-to-cached-PHP execution model — no per-request parsing in production. The API is small and the install is a single Composer package. The honest caveats: the package has essentially no downstream dependents, so you are the support tier; documentation is anchored to ThinkPHP's docs rather than this package; and auto-escaping behavior should be verified in source before we trust it with user-supplied content. Recommendation: adopt for ThinkPHP-adjacent and internal server-rendered surfaces, wrap it behind a thin internal view abstraction so we retain an exit path, and benchmark it against Twig or Plates if the surface grows beyond internal tooling.
How can I help you explore Laravel packages today?