1. Go to this page and download the library: Download fiskhandlarn/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/ */
fiskhandlarn / blade example snippets
blade('index', ['machine' => 'Voight-Kampff']);
use Fiskhandlarn\Blade;
$blade = new Blade(get_stylesheet_directory() . '/views', get_stylesheet_directory() . '/cache');
echo $blade->render('index', ['machine' => 'Voight-Kampff']);
blade_controller('index', 'Index');
echo $blade->renderController('index', 'Index');
blade_controller('index', 'Index', ['lifespan' => "A coding sequence cannot be revised once it's been established."]);
echo $blade->renderController('index', 'Index', ['lifespan' => "A coding sequence cannot be revised once it's been established."]);
blade_directive('datetime', function ($expression) {
return " echo with({$expression})->format('Y-m-d H:i:s');
$blade->directive('datetime', function ($expression) {
return " echo with({$expression})->format('Y-m-d H:i:s');
{{-- In your Blade template --}}
@php $dateObj = new DateTime('2019-11-01 00:02:42') @endphp
@datetime($dateObj)
// Make variable available in all views
blade_composer('*', function ($view) {
$view->with(['badge' => 'B26354']);
});
// Make variable available in all views
$blade->composer('*', function ($view) {
$view->with(['badge' => 'B26354']);
});
// Make variable available in all views
blade_share(['badge' => 'B26354']);