1. Go to this page and download the library: Download lotfio/caprice 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/ */
lotfio / caprice example snippets
composer
composer test
use Caprice\Caprice;
// load caprice predefined directives
$caprice->loadPredefinedDirectives();
// set views location and cache location
$caprice->setCompileLocations('views', 'cache');
// helpful for development environment
$caprice->enableRecompile();
// file to compile => views/test.cap.php
// you can remove .cap.php extension for both
$compiled = $caprice->compile("test");
// simple directives
$caprice->directive("#test", function(){
return 'replace test directive with this string';
});
// expression directive
// example #call($var)
$caprice->directive("#call", function(string $expression, string $match, array $extras){
return ' call'. $expression . ';