Skip to content
Use Laravel Blade in any PHP project with minimal footprints.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
tests
.editorconfig
.gitignore
.travis.yml
README.md
composer.json
phpunit.xml

README.md

Build Status Latest Stable Version License 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.

Requirements

  • PHP 5.6+

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(__DIR__ . '/views', __DIR__ . '/cache');

echo $blade->make('home', ['foo' => '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('*', function ($view) {
    $view->with(['foo' => 'bar']);
});

... and so on. Just use Blade as you are used to.

Enjoy!

License

MIT

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.