1. Go to this page and download the library: Download sailantis/clarity-engine 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/ */
sailantis / clarity-engine example snippets
Clarity\ClarityEngine;
// Initialize the engine
$engine = new ClarityEngine([
'viewPath' => __DIR__ . '/views',
]);
// Render a template. The second argument is the template's scope.
echo $engine->render('welcome', [
'title' => 'Welcome to Clarity',
'user' => (object) ['name' => 'Developer'], // object -> {{ user.name }}
// 'user' => ['name' => 'Developer'], // array -> {{ user:name }}
]);
use Clarity\Engine\Policy;
$engine->setPolicy(Policy::sandboxed()); // the default
$engine->setPolicy(Policy::open()); // everything on
$engine->setPolicy(Policy::custom() // grant one thing, not all
->allowCapability('methodCalls')
->allowFunctions('strtoupper', 'count'));
use Clarity\Engine\Policy;
$engine->setPolicy(Policy::open()); // full PHP: any function, methods, raw PHP
$engine->setPolicy(Policy::custom()
->allowCapability('methodCalls')
->allowFunctions('strtoupper', 'count'));
bash
php vendor/bin/phpunit
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.