PHP code example of luoyy / blade

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

    

luoyy / blade example snippets



luoyy\Blade\Compilers\BladeCompiler;
use luoyy\Blade\Engines\CompilerEngine;
use luoyy\Blade\Engines\EngineResolver;
use luoyy\Blade\Engines\FileEngine;
use luoyy\Blade\Engines\PhpEngine;
use luoyy\Blade\Factory;
use luoyy\Blade\Filesystem\Filesystem;
use luoyy\Blade\FileViewFinder;

$path = ['view_path']; // your view file path, it's an array
$cachePath = '/cache_path'; // compiled file path

$file = new Filesystem;
$compiler = new BladeCompiler($file, $cachePath);

// you can add a custom directive if you want
$compiler->directive('datetime', function ($timestamp) {
    return preg_replace('/(\(\d+\))/', ' echo date("Y-m-d H:i:s", $1);