Package Data | |
---|---|
Maintainer Username: | nsrosenqvist |
Maintainer Contact: | niklas.s.rosenqvist@gmail.com (Niklas Rosenqvist) |
Package Create Date: | 2017-03-14 |
Package Last Update: | 2020-03-05 |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-11-11 15:08:27 |
Package Statistics | |
---|---|
Total Downloads: | 365 |
Monthly Downloads: | 4 |
Daily Downloads: | 3 |
Total Stars: | 2 |
Total Watchers: | 4 |
Total Forks: | 1 |
Total Open Issues: | 0 |
This is a simple PHP class that wraps Laravel's Blade compiler into a reusable component. This abstraction makes it very convenient to use the Blade templating engine in other projects that aren't built with Laravel.
Sample code
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