PHP code example of koine / view

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

    

koine / view example snippets


$config  = new \Koine\View\Config;

$config->addPath('/path1')
    ->addPath('/path2')
    ->addPaths(array(
        'path3',
        'path4',
    ));

$config->setHelper('escaper', new \MyEscaper());

$viewRenderer = new \Koine\View\Renderer($config);

echo $viewRenderer->render('post_template.phtml', array(
    'title'        => 'Some Title',
    'body'         => 'Some content',
    'relatedPosts' => $relatedPosts,
));
phtml
<!-- post_template.phtml -->
<article>
    <!-- either $this->escape() or $this->getHelper('escaper')->escape() will work -->
    <h1><?= $this->escape($title)