wpdesk / wp-view
2.1.0
2024-06-12 12:05 UTC
Requires
- php: >=7.0 | ^8
Requires (Dev)
This package is auto-updated.
Last update: 2024-10-12 14:33:45 UTC
README
WP View
wp-view is a simple library to render templates.
Requirements
PHP 7.0 or later.
Installation via Composer
In order to install the bindings via Composer run the following command:
composer require wpdesk/wp-view
Example usage
<?php
$resolver = new \WPDesk\View\Resolver\ChainResolver();
$resolver->appendResolver( new \WPDesk\View\Resolver\WPThemeResolver( 'example-plugin' ) );
$resolver->appendResolver( new \WPDesk\View\Resolver\DirResolver( trailingslashit( __DIR__ ) . 'templates' ) );
$renderer = new \WPDesk\View\Renderer\SimplePhpRenderer( $resolver );
$renderer->render( 'template-name', ['param1' => 'test'] );