merophp/html-view

HTML view plugin for merophp/view-engine

0.1-alpha 2022-01-12 16:43 UTC

This package is auto-updated.

Last update: 2024-10-29 06:41:44 UTC


README

HTML view plugin for merophp/view-engine.

Installation

Via composer:

composer require merophp/html-view

Basic Usage

require_once 'vendor/autoload.php';

use Merophp\HtmlViewPlugin\HtmlView;

use Merophp\ViewEngine\ViewEngine;
use Merophp\ViewEngine\ViewPlugin\Collection\ViewPluginCollection;
use Merophp\ViewEngine\ViewPlugin\Provider\ViewPluginProvider;
use Merophp\ViewEngine\ViewPlugin\ViewPlugin;

$collection = new ViewPluginCollection();
$collection->add(
    new ViewPlugin(HtmlView::class),
]);

$provider = new ViewPluginProvider($collection);

$viewEngine = new ViewEngine($provider);

$view = $viewEngine->initializeView();
$view->html('My HTML');
echo $viewEngine->renderView($view);