PHPackages                             webrium/view - 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. [Templating &amp; Views](/categories/templating)
4. /
5. webrium/view

ActiveLibrary[Templating &amp; Views](/categories/templating)

webrium/view
============

Lightweight PHP template engine with hybrid static caching (no eval) for the Webrium framework.

1.0.3(3w ago)2191[3 issues](https://github.com/webrium/view/issues)MITPHPPHP ^8.1

Since Dec 5Pushed 1w agoCompare

[ Source](https://github.com/webrium/view)[ Packagist](https://packagist.org/packages/webrium/view)[ Docs](https://github.com/webrium/view)[ RSS](/packages/webrium-view/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (3)Dependencies (1)Versions (8)Used By (0)

Webrium View
============

[](#webrium-view)

Lightweight PHP template engine with hybrid static caching (no `eval`, no `DOMDocument`) for the [Webrium](https://github.com/webrium) framework.

- **GitHub:**
- **Packagist:**
- **Install:** `composer require webrium/view`

Webrium View gives you a tiny template engine plus an optional static HTML cache. It compiles your templates to plain PHP files, never uses `eval`, and is designed to play nicely with modern frontend frameworks (Vue, Alpine, Livewire, etc.) by leaving their attributes untouched.

Features
--------

[](#features)

- **DOM-less streaming compiler** – custom HTML parser, no `DOMDocument`, so attributes like `@click`, `:class`, `x-data`, `wire:click`, `hx-get`, etc. are preserved exactly as written.
- **Hybrid static cache** – render a page once, save it as static HTML with a TTL, and serve the static file on future requests.
- **Blade-style directives** – `@section`, `@yield`, `@component`, `@{{ }}`, `@raw()`, `@json()` / `@tojs()`, `@php()`.
- **Attribute-based control flow** – `w-if`, `w-else-if`, `w-else`, `w-for` on normal HTML elements.
- **Fine-grained opt-out** – `w-skip` to disable DOM-level processing in a subtree (useful when embedding another templating system).
- **Safe by default** – escaped output for `@{{ }}`, explicit opt-in to raw HTML and raw PHP.

Requirements
------------

[](#requirements)

- PHP **8.1+**

No extra PHP extensions are required; Webrium View uses only core functions.

Installation
------------

[](#installation)

### 1. Via Composer (recommended)

[](#1-via-composer-recommended)

```
composer require webrium/view
```

Then bootstrap it in your project:

```
