wpdesk/wp-view

Maintainers

Details

gitlab.wpdesk.dev/wpdesk/wp-view

Installs: 55 633

Dependents: 17

Suggesters: 0

Security: 0

2.1.0 2024-06-12 12:05 UTC

README

pipeline status coverage report Latest Stable Version Total Downloads License

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'] );