Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Latest Stable Version Total Downloads

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 renewablesys/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!

License

WTFPL

About

Use Laravel Blade in any PHP project.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages