1. Go to this page and download the library: Download peak/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/ */
class EscapeTextHelper
{
public function __invoke($text)
{
return filter_var($text, FILTER_SANITIZE_SPECIAL_CHARS);
}
}
$view->setHelpers([
'escape' => new EscapeTextHelper(),
// ...
]);
...
<h1>Hello <?= $this->escape($this->name)
$view->setDirectives([
// give you ability to print variable with syntax {{ $myVar }}
new EchoDirective(),
// give you ability to call native php functions,
// macros or helpers with syntax @function(...args)
new FnDirective(),
]);
$view->addVars([
'name' => 'bob'
'messages' => [
// ...
],
'items' => [
'property' => 'value'
]
]);
$this->layoutContent
html
<div class="container">
hello <?= $this->name
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.