PHP code example of binjuhor / blade
1. Go to this page and download the library: Download binjuhor/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/ */
binjuhor / blade example snippets
use Binjuhor\Blade\BladeTemplate;
$template = new BladeTemplate([
'views' => 'path/to/views/folder',
'cache' => 'path/to/cache/folder',
'compileDir' => 'path/to/compiled/folder',
'url' => 'http://your-app-url.test'
]);
echo $template->render('view', ['data' => 'value']);
$template->compile();
use Binjuhor\Blade\BladeTemplate as Blade;
$compileDir = __DIR__ . '/compiles';
$viewDirectory = __DIR__ . '/resources/views';
$cacheDirectory = __DIR__ . '/cache';
$page = isset($_REQUEST['f']) ? $_REQUEST['f'] : 'index';
$blade = new Blade([
'view' => $viewDirectory,
'cache' => $cacheDirectory,
'compileDir' => $compileDir,
'url' => 'http://html-generator.test'
]);
echo $blade->render($page);
$blade->compiles();
./index.php
./cache
./compiles
./resources
/assets
/css
/js
/images
/views
about.blade.php
contact.blade.php
home.blade.php
404.blade.php
/partials
header.blade.php
footer.blade.php
sidebar.blade.php