Zing. compile-to-PHP template engine GitHub ↗

Caching

Compiled templates are cached automatically. A cached template refreshes if the source .zing file changes.

What if compilation fails?

If a .zing file has a syntax error and you try to render it, Zing serves the last known-good compiled version instead of crashing.

This is handy during development — you can fix the template and reload the page without your whole site going down. But in production or in tests, you probably want the error to fail loudly. Use Flags::STRICT_MODE for that:

$engine = new Engine(
    viewPath: __DIR__ . '/resources/views',
    cachePath: __DIR__ . '/storage/zing-cache',
    flags: Flags::STRICT_MODE,
);

With STRICT_MODE, a compilation error throws instead of falling back to a stale cached version.