PHP code example of nueve / view-presenter

1. Go to this page and download the library: Download nueve/view-presenter library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

nueve / view-presenter example snippets


$viewParser = new Nueve\ViewPresenter\PhpParser('template_directory_path');
$presentable = new Nueve\ViewParser\Presentable();
$view = new Nueve\ViewPresenter\View($viewParser, $presentable);



class SitePresenter implements \Nueve\ViewPresenter\PresenterInterface
{
    public function data()
    {
        return [
            'site_name' => 'Test Site',
            'site_description' => 'This is a test site to show how this works.'
        ];
    }
}

$view->presenter('home', new SitePresenter());

$view->render('home.php', [
    'developer' => 'Some Person'
]);

<header>
    <h1><?=$site_name