| Package Data | |
|---|---|
| Maintainer Username: | xaamin |
| Maintainer Contact: | xaamin@outlook.com (Benjamín Martínez Mateos) |
| Package Create Date: | 2016-12-29 |
| Package Last Update: | 2021-03-10 |
| Language: | PHP |
| License: | Unknown |
| Last Refreshed: | 2025-11-04 03:02:47 |
| Package Statistics | |
|---|---|
| Total Downloads: | 1,485 |
| Monthly Downloads: | 0 |
| Daily Downloads: | 0 |
| Total Stars: | 0 |
| Total Watchers: | 1 |
| Total Forks: | 1 |
| Total Open Issues: | 0 |
Standalone version of Blade templating engine for use outside of Laravel.
composer require xaamin/blade
Create a Blade instance by passing it the folder(s) where your view files are located, and a cache folder. Render a template by calling the make method.
use Xaamin\Blade\View;
$view = new View('views', 'cache');
echo $view->make('home', ['name' => 'John Doe']);
Now you can easily create a directive by calling the compiler() function
$view->compiler()->directive('money', function ($expression) {
return "<?= '$ ' . number_format($expression, 2, '.', ','); ?>";
});
In your Blade Template
<?php $decimal = '520.50' ?>
@datetime($decimal)
The Blade instances passes all methods to the internal view factory. So methods such as exists, file, share, composer and creator are available as well.
More information about the Blade templating engine can be found on http://laravel.com/docs/5.3/blade.