| Package Data | |
|---|---|
| Maintainer Username: | terranc | 
| Maintainer Contact: | terran.chao@lookfeel.co (terranc) | 
| Package Create Date: | 2017-02-03 | 
| Package Last Update: | 2017-02-04 | 
| Home Page: | http://laravel.com/docs/5.4/blade | 
| Language: | PHP | 
| License: | MIT | 
| Last Refreshed: | 2025-10-31 03:04:47 | 
| Package Statistics | |
|---|---|
| Total Downloads: | 1,653 | 
| Monthly Downloads: | 4 | 
| Daily Downloads: | 1 | 
| Total Stars: | 2 | 
| Total Watchers: | 1 | 
| Total Forks: | 1 | 
| Total Open Issues: | 0 | 
Use Laravel Blade templates without the full Laravel framework.(component & slot support)
composer require terranc/blade
<?php
$path = ['/view_path'];         // your view file path, it's an array
$cachePath = '/cache_path';     // compiled file path
$compiler = new \terranc\Blade\Compilers\BladeCompiler($cachePath);
// you can add a custom directive if you want
$compiler->directive('datetime', function($timestamp) {
    return preg_replace('/(\(\d+\))/', '<?php echo date("Y-m-d H:i:s", $1); ?>', $timestamp);
});
$engine = new \terranc\Blade\Engines\CompilerEngine($compiler);
$finder = new \terranc\Blade\FileViewFinder($path);
// if your view file extension is not php or blade.php, use this to add it
$finder->addExtension('tpl');
// get an instance of factory
$factory = new \terranc\Blade\Factory($engine, $finder);
// render the template file and echo it
echo $factory->make('hello', ['a' => 1, 'b' => 2])->render();
You can enjoy almost all the features of blade with this extension. However, remember that some of exclusive features are removed.
You can't:
@inject @can @cannot @lang in a template fileDocumentation: http://laravel.com/docs/5.4/blade
Thanks for Laravel and it authors. That is a great project.
https://github.com/terranc/think-blade