Download the PHP package webrium/view without Composer

On this page you can find all versions of the php package webrium/view. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package view

Webrium View

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

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

Requirements

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

Installation

1. Via Composer (recommended)

Then bootstrap it in your project:

The directories will be created automatically if they do not exist.

2. Manual install (alternative)

If you prefer not to use Composer, copy Engine.php, View.php, and Parser.php into your project, keep the Webrium\View namespace, and load them via your own autoloader or simple require statements.

Quick Start

1. Simple render

views/hello.php

public/index.php

2. Layout + section example

views/layouts/main.php

views/pages/home.php

public/index.php

Template Syntax & Directives

Webrium View uses a custom streaming HTML parser (not DOMDocument). It scans your HTML, rewrites special attributes and directives into plain PHP, and leaves everything else alone.

Escaped output – @{{ ... }}

Escaped output is the default:

Compiles to:

Raw output – @raw(...)

Use raw output only when you are sure the content is safe:

Compiles to:

Raw PHP – @php(...)

You can inject raw PHP (enabled by default):

If you want to disable this directive for security reasons:

Any use of @php(...) after that will throw a ViewTemplateException.

JSON / JavaScript – @json(...) and @tojs(...)

Both directives are equivalent and produce json_encode'd output:

You can also use them inside attributes:

Layouts – @section, @endsection, @yield

Child view

Layout

Available helpers in Webrium\View\View:

Components – @component(...)

Or call it directly from PHP:

Loops – w-for

Use w-for on an element to generate a foreach:

Compiles to:

Conditionals – w-if, w-else-if, w-else

Compiles to:

Disabling processing in a subtree – w-skip

Add w-skip to any element to disable DOM-level processing for that element and all its descendants:

Behavior:

Useful when embedding another frontend framework's attributes:

<script> / <style> behavior

Contents are treated as raw text (not parsed as nested HTML):

Hybrid Static Cache

Signature:

Cache TTL constants

You can also override the default TTL:

Mode 1 – Direct data (always re-render)

Mode 2 – Lazy factory (only run when needed)

The factory is called only when no valid cache exists or the cache has expired.

Mode 3 – Read-only access

Returns false if no valid (non-expired) cache exists.

Directory Helpers & Clearing Caches

Error Handling

ViewException covers bad directories, missing view files, and I/O failures. ViewTemplateException covers invalid w-for / w-if syntax, unclosed tags, unmatched directive parentheses, and disabled @php() usage.

Editor.js Integration

Webrium View includes a built-in parser that converts Editor.js JSON output to clean HTML.

Supported block types

Block type Output
paragraph <p>
header <h1><h6>
list <ul> / <ol>
nestedList Nested <ul> / <ol>
image <figure><img></figure>
quote <blockquote>
code <pre><code>
table <table> with optional <thead>
delimiter <hr>
embed <iframe> wrapper
warning Alert <div>
raw Verbatim HTML pass-through
checklist <ul> with checkboxes
linkTool Anchor card with optional image
attaches Download link with file size
personality Author card

Basic usage

Then render it in a template:

Full example:

Custom CSS classes

Registering custom block handlers

Inline HTML sanitization

By default the parser allows common inline tags and strips everything else. To disable sanitization:

Note: The raw block type always passes HTML through as-is, regardless of the sanitize flag.

Notes

License

MIT

Contributing

Open issues and pull requests on GitHub. Ideas, bug reports, and feature suggestions are very welcome.


All versions of view with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package webrium/view contains the following files

Loading the files please wait ...