PHP code example of idealogica / good-view

1. Go to this page and download the library: Download idealogica/good-view 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/ */

    

idealogica / good-view example snippets


$viewFactory = ViewFactory::createStreamViewFactory(
    new StreamFactory(),
    ['content' => '<div>'],
    [__DIR__ . '/templates']
);
$view = $viewFactory->create('test');
$stream = $view->render(); // StreamInterface instance
$contents = $stream->getContents(); // rendered string

 $this->setLayout('layout') 

!<?= trim($content)