PHP code example of leafs / blade

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

    

leafs / blade example snippets


use Leaf\Blade;

$blade = new Blade('app/views', 'app/views/cache');


$blade = new Blade;

// somewhere, maybe in a different file
$blade->configure("app/views", "app/views/cache");

echo $blade->make('index', ['name' => 'Michael Darko'])->render();

echo $blade->render('index', ['name' => 'Michael Darko']);

<!Doctype html>
<html>
    <head>
        <title>{{ $name }}</title>
    </head>
    <body>
        <div class="container">{{ $name }}</div>
    </body>
</html>

$blade->directive('datetime', function ($expression) {
    return " echo with({$expression})->format('F d, Y g:i a');