benjamincrozat / blade
This package is abandoned and no longer maintained.
No replacement package was suggested.
Use Laravel Blade in any PHP project.
3.0.0
2020-12-17 14:44 UTC
Requires
- php: ^7.4|^8.0
- illuminate/view: ^8.0
Requires (Dev)
- phpunit/phpunit: ^9.5
README
Blade
Use Laravel Blade in any PHP project. The adapter class is clean and I don't make use of unecessary Laravel related dependencies.
If you don't know about Blade yet, please refer to the official documentation.
Installation
composer require benjamincrozat/blade
Usage
This package allows you to do almost everything you were able to do in a Laravel project.
Here is a basic view rendering:
use BC\Blade\Blade; $blade = new Blade('views', 'cache'); echo $blade->make('home') ->withFoo('bar') ->render();
Add the @hello('John')
directive:
$blade->directive('hello', function ($expression) { $expression = trim($expression, '\'"'); return "<?php echo 'Hello $expression!'; ?>"; });
Make a variable available in all views thanks to view composers:
$blade->composer('*', fn ($view) => $view->withFoo('bar'));
... and so on. Just use Blade as you are used to.
Enjoy!