PHP code example of nsrosenqvist / blade-compiler
1. Go to this page and download the library: Download nsrosenqvist/blade-compiler 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/ */
nsrosenqvist / blade-compiler example snippets
use NSRosenqvist\Blade\Compiler;
$cacheDir = "storage/cache/views";
$baseDirs = [
'app/views',
'module/views',
];
$blade = new Compiler($cacheDir, $baseDirs);
$index = $blade->render('index')
// Only works when baseDirs are set (note that just
// 'index.blade.php' wouldn't work since Blade would
// interpret that as 'index/blade/php')
$index = $blade->render('/path/to/index.blade.php')
// Absolute paths always works