walnut/lib_viewrenderer

There is no license information available for the latest version (dev-main) of this package.

dev-main 2024-09-15 21:33 UTC

This package is not auto-updated.

Last update: 2024-10-28 20:19:27 UTC


README

This is a very basic view renderer that maps any PHP class (view) to a template file.

Examples

The usage is straightforward

//Setup (usually done via DI)
$renderer = new PhpTemplateRenderer(
	new PerFileTemplateNameMapper('templates', 'php')
);

$viewMapper = new LookupViewMapper([
    HomePageView::class => 'home-page',
    AboutPageView::class => 'about-page'
])

$adapter = new ViewRendererAdapter($renderer, $viewMapper);

//Usage
$view = new HomePageView;
$adapter->render($view);