codemonster-ru/view-php

PHP template engine for codemonster-ru/view

v2.0.0 2025-09-28 09:26 UTC

This package is auto-updated.

Last update: 2025-09-28 09:27:54 UTC


README

Latest Version on Packagist Total Downloads License Tests

PHP template engine for the codemonster-ru/view core.
Uses the core Locator for consistent file resolution (dot-notation, namespaces, multiple base paths).

๐Ÿ“ฆ Installation

Via Composer:

composer require codemonster-ru/view-php

๐Ÿš€ Usage

use Codemonster\View\View;
use Codemonster\View\Locator\DefaultLocator;
use Codemonster\View\Engines\PhpEngine;

$locator = new DefaultLocator([__DIR__ . '/resources/views']); // can be an array
$engine = new PhpEngine($locator, 'php'); // or ['phtml','php']
$view = new View(['php' => $engine], 'php');

echo $view->render('emails.welcome', ['user' => 'Vasya']);

๐Ÿงช Testing

You can run tests with the command:

composer test

๐Ÿ‘จโ€๐Ÿ’ป Author

Kirill Kolesnikov

๐Ÿ“œ License

MIT