PHPackages                             wpdiggerstudio/wpzylos-views - 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. wpdiggerstudio/wpzylos-views

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

wpdiggerstudio/wpzylos-views
============================

PHP template engine with optional Twig adapter for WPZylos framework

v1.0.0(5mo ago)02341MITPHPPHP ^8.0CI failing

Since Feb 1Pushed 2w agoCompare

[ Source](https://github.com/WPDiggerStudio/wpzylos-views)[ Packagist](https://packagist.org/packages/wpdiggerstudio/wpzylos-views)[ Docs](https://github.com/WPDiggerStudio/wpzylos-views)[ Fund](https://www.paypal.com/donate/?hosted_button_id=66U4L3HG4TLCC)[ RSS](/packages/wpdiggerstudio-wpzylos-views/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (7)Versions (2)Used By (1)

WPZylos Views
=============

[](#wpzylos-views)

[![PHP Version](https://camo.githubusercontent.com/911a83e2aa6fe73660ab613629a95c76622bf03049a7344e80c5ea72d4ef9c7d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253545382e302d626c7565)](https://php.net)[![License](https://camo.githubusercontent.com/f8df3091bbe1149f398a5369b2c39e896766f9f6efba3477c63e9b4aa940ef14/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e)](LICENSE)[![GitHub](https://camo.githubusercontent.com/dbe820b98864e115173c422b9472b725cfa678bee03b66ff2c453dad95a3d20b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4769744875622d575044696767657253747564696f2d3138313731373f6c6f676f3d676974687562)](https://github.com/WPDiggerStudio/wpzylos-views)

PHP template rendering with optional Twig adapter for WPZylos framework.

📖 **[Full Documentation](https://wpzylos.com)** | 🐛 **[Report Issues](https://github.com/WPDiggerStudio/wpzylos-views/issues)**

---

Features
--------

[](#features)

- **PHP Templates** - Native PHP templates with output buffering and safe data extraction
- **Optional Twig Support** - Plug in Twig for autoescape and template syntax
- **Multi-Engine Architecture** - Register custom template engines via `EngineInterface`
- **Shared View Data** - Share data globally across all views
- **Deferred Rendering** - Create `View` instances and render later
- **Dot Notation** - Reference views with dot notation (`admin.settings`)
- **CssHelper** - DaisyUI CSS prefix helper for style isolation (`cls()`, `prefix()`, `adminRootId()`, `adminOpen()`, `adminClose()`)
- **JsMount** - Vue.js/React mount point renderer (`adminMount()`, `frontendMount()`, `shortcodeMount()`)
- **Vue.js 3 Options API** - First-class support for Vue.js 3 with Options API
- **React 19** - Opt-in React 19 support for modern frontend development
- **DaisyUI v5 + Tailwind v4** - Integrated DaisyUI component styling with CSS prefix isolation

---

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

[](#requirements)

RequirementVersionPHP^8.0WordPress6.0+---

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

[](#installation)

```
composer require wpdiggerstudio/wpzylos-views
```

For Twig template support (optional):

```
composer require twig/twig:^3.0
```

---

Quick Start
-----------

[](#quick-start)

```
use WPZylos\Framework\Views\ViewFactory;

// Get from container
$views = $app->make('view');

// Render a view immediately
echo $views->render('admin.settings', [
    'title' => 'Settings',
    'options' => $options,
]);

// Or create a deferred View instance
$view = $views->make('admin.dashboard')
    ->with('stats', $stats)
    ->with('user', $currentUser);

echo $view; // Renders when cast to string
```

---

Core Features
-------------

[](#core-features)

### Rendering Views

[](#rendering-views)

The `ViewFactory` resolves view names to template files and renders them:

```
// Renders: resources/views/products/index.php
echo $views->render('products.index', ['products' => $products]);

// Renders: resources/views/admin/settings.php
echo $views->render('admin.settings', ['tab' => 'general']);
```

### Deferred Rendering

[](#deferred-rendering)

Use `make()` to create a `View` instance that can be passed around and rendered later:

```
$view = $views->make('emails.welcome', ['user' => $user]);

// Add more data
$view->with('siteName', get_bloginfo('name'));
$view->with(['footer' => $footer, 'year' => date('Y')]);

// Render when ready
$html = $view->render();

// Or use as string (calls render automatically)
echo $view;
```

### Sharing Data

[](#sharing-data)

Share data that will be available to all views:

```
$views->share('siteName', get_bloginfo('name'));
$views->share('currentUser', wp_get_current_user());

// Share multiple values at once
$views->share([
    'version' => '1.0.0',
    'debug' => WP_DEBUG,
]);
```

### Checking View Existence

[](#checking-view-existence)

```
if ($views->exists('admin.custom-page')) {
    echo $views->render('admin.custom-page');
} else {
    echo $views->render('admin.fallback');
}
```

### PHP Templates

[](#php-templates)

PHP templates receive data as extracted variables:

```

```

### Twig Templates

[](#twig-templates)

Register the Twig engine and use `.twig` templates:

```
use WPZylos\Framework\Views\Engines\TwigEngine;

$twig = new TwigEngine($views->getBasePath(), '/path/to/cache', false);
$views->addEngine($twig);

// Now .twig files are resolved automatically
echo $views->render('emails.welcome', ['user' => $user]);
```

```
{# resources/views/emails/welcome.twig #}
Welcome, {{ user.name }}!
Thanks for joining {{ siteName }}.
```

---

### CssHelper — DaisyUI CSS Prefix Helper

[](#csshelper--daisyui-css-prefix-helper)

The `CssHelper` class generates prefixed CSS class names for DaisyUI components, ensuring style isolation between plugins:

```
use WPZylos\Framework\Views\CssHelper;

// Injected automatically via container
$css = $app->make(CssHelper::class);

// Generate prefixed class names
echo $css->cls('btn', 'btn-primary');
// Output: 'fcds-btn fcds-btn-primary'

// Get the raw prefix
echo $css->prefix();       // 'fcds-'
echo $css->prefixClean();  // 'fcds'

// Admin root container helpers
echo $css->adminOpen();    //
echo $css->adminClose();   //
echo $css->adminRootId();  // 'fcds-admin'
```

### JsMount — Vue.js / React Mount Points

[](#jsmount--vuejs--react-mount-points)

The `JsMount` class renders mount points for Vue.js and React apps with WordPress data passing:

```
use WPZylos\Framework\Views\JsMount;

$mount = $app->make(JsMount::class);

// Admin page mount point (wrapped in admin root scope)
echo $mount->adminMount('my-vue-app', [
    'nonce'   => wp_create_nonce('wp_rest'),
    'restUrl' => rest_url('myplugin/v1'),
]);

// Frontend mount point (no admin wrapper)
echo $mount->frontendMount('product-gallery', [
    'products' => $products,
]);

// Shortcode mount point
echo $mount->shortcodeMount('contact-form', [
    'action' => admin_url('admin-ajax.php'),
]);
```

### Vue.js 3 &amp; React 19 Support

[](#vuejs-3--react-19-support)

WPZylos Views supports both **Vue.js 3** (Options API) and **React 19** (opt-in) for building interactive admin and frontend interfaces:

- **Vue.js 3 Options API** — Use `JsMount::adminMount()` to create a mount point, then mount your Vue app to the rendered element ID
- **React 19** — Opt-in support via the same mount point system; switch your JS entry to `createRoot()` instead of `createApp()`
- **DaisyUI v5 + Tailwind v4** — All components use prefixed DaisyUI classes via `CssHelper` for zero-conflict styling

---

Related Packages
----------------

[](#related-packages)

PackageDescription[wpzylos-core](https://github.com/WPDiggerStudio/wpzylos-core)Application foundation[wpzylos-routing](https://github.com/WPDiggerStudio/wpzylos-routing)URL routing[wpzylos-scaffold](https://github.com/WPDiggerStudio/wpzylos-scaffold)Plugin template---

Documentation
-------------

[](#documentation)

For comprehensive documentation, tutorials, and API reference, visit **[wpzylos.com](https://wpzylos.com)**.

---

Support the Project
-------------------

[](#support-the-project)

- [GitHub Sponsors](https://github.com/sponsors/wpdiggerstudio)
- [PayPal Donate](https://www.paypal.com/donate/?hosted_button_id=66U4L3HG4TLCC)

---

License
-------

[](#license)

MIT License. See [LICENSE](LICENSE) for details.

---

Contributing
------------

[](#contributing)

Contributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.

---

**Made with love by [WPDiggerStudio](https://github.com/WPDiggerStudio)**

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance86

Actively maintained with recent releases

Popularity11

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity39

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

153d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/55980087?v=4)[WPDiggerStudio](/maintainers/WPDiggerStudio)[@WPDiggerStudio](https://github.com/WPDiggerStudio)

---

Top Contributors

[![WPDiggerStudio](https://avatars.githubusercontent.com/u/55980087?v=4)](https://github.com/WPDiggerStudio "WPDiggerStudio (11 commits)")

---

Tags

wordpresstwigbladetemplatesviewsRenderingwpzylos

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/wpdiggerstudio-wpzylos-views/health.svg)

```
[![Health](https://phpackages.com/badges/wpdiggerstudio-wpzylos-views/health.svg)](https://phpackages.com/packages/wpdiggerstudio-wpzylos-views)
```

###  Alternatives

[timber/timber

Create WordPress themes with beautiful OOP code and the Twig Template Engine

5.7k3.7M132](/packages/timber-timber)[league/plates

Plates, the native PHP template system that's fast, easy to use and easy to extend.

1.5k6.2M273](/packages/league-plates)[igaster/laravel-theme

Laravel Themes: Asset &amp; Views folder per theme. Theme inheritance. Blade integration and more...

5241.2M14](/packages/igaster-laravel-theme)[log1x/sage-directives

A set of Blade directives for use with Roots Sage.

296750.0k10](/packages/log1x-sage-directives)[gamajo/template-loader

A class for your WordPress plugin, to allow loading template parts with fallback through the child theme &gt; parent theme &gt; plugin

29849.6k5](/packages/gamajo-template-loader)[hedronium/spaceless-blade

Adds the @spaceless tag to Blade. (works like in Twig)

32650.3k1](/packages/hedronium-spaceless-blade)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
