PHP code example of bjornbasar / karhu-view

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

    

bjornbasar / karhu-view example snippets


use Karhu\View\TwigAdapter;

$view = new TwigAdapter(__DIR__ . '/templates');
$html = $view->render('home.html.twig', ['name' => 'karhu']);

return (new Response())->withHeader('Content-Type', 'text/html')->withBody($html);

use Karhu\View\ViewInterface;

final class BladeAdapter implements ViewInterface {
    public function render(string $template, array $data = []): string { /* ... */ }
}