Skip to content
PHP Blade template engine outside Laravel
Branch: master
Clone or download
Pull request Compare This branch is even with rakit:master.
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
.gitignore
.travis.yml
README.md
composer.json
phpunit.xml.dist

README.md

Rakit Blade

Build Status License

Blade Template Engine outside Laravel Framework.

Usage Example

<?php

require('vendor/autoload.php');

use Rakit\Blade\Blade;

$view_paths = [ __DIR__.' /views' ];
$view_cache_path = __DIR__.'/cache/views';

$blade = new Blade($view_paths, $view_cache_path);

// then, you can render blade file using `render` method
$rendered = $blade->render('myview');

// or render with data
$rendered = $blade->render('myview', [ 'message' => 'foobar' ]);

Extending Compiler

You can extend compiler using extend method.


// register @upper() compiler 
$blade->extend(function($view, $compiler) {
    $pattern = $compiler->createMatcher('upper');
    return preg_replace($pattern, '$1<?php echo strtoupper($2); ?>', $view);
});

// you can use it in your view file by @upper('my string')
You can’t perform that action at this time.