Skip to content

codemonster-ru/view-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

codemonster-ru/view-php

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