PHPackages                             forme/platine - 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. forme/platine

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

forme/platine
=============

A pure PHP templating library with layouts, components and slots.

v0.0.5(3mo ago)1191MITPHPPHP ^8.3

Since Mar 11Pushed 3mo agoCompare

[ Source](https://github.com/formewp/forme-platine)[ Packagist](https://packagist.org/packages/forme/platine)[ RSS](/packages/forme-platine/feed)WikiDiscussions main Synced 3w ago

READMEChangelogDependencies (6)Versions (6)Used By (1)

Platine
=======

[](#platine)

A pure PHP templating library with layouts, components and slots.

Platine is the default templating library for [Forme](https://formewp.github.io), a WordPress MVC framework, but can be used in any PHP project.

Background
----------

[](#background)

Platine is a hard fork of Plates v4 alpha by RJ Garcia ([@ragboyjr](https://github.com/ragboyjr)). V4 alpha introduced some substantial improvements over v3 — a functional extension system, a composable render pipeline, a render context object (`$v`), and a component/slot system.

Unfortunately the v4 branch was reverted and the changes were never released. The Plates repository returned to v3 and v4 development was abandoned. Some features are being ported back but the file-based component and slot system was shelved in favour of an inline function approach.

Platine preserves and continues that v4 work. The core architecture is intact and the library is maintained as a standalone package independent of the PHP League.

If you were using or interested in Plates v4, this is its continuation.

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

[](#requirements)

- PHP 8.3+

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

[](#installation)

```
composer require forme/platine
```

Getting Started
---------------

[](#getting-started)

Create a view instance with a base directory for your templates:

```
use Forme\Platine\Engine;

$view = Engine::create('/path/to/views', 'plate.php');
```

Render a template, passing in an array of data:

```
echo $view->render('home', ['title' => 'Hello World']);
```

Templates
---------

[](#templates)

Template files are plain PHP files. The render context object is available as `$v` within every template.

```
// views/home.plate.php

```

Use `$v->e()` to escape output:

```

```

Layouts
-------

[](#layouts)

Declare a layout at the top of your template:

```
