Answer the question
In order to leave comments, you need to log in
How to use Laravel Blade outside of Laravel as a class?
The instructions of the Laravel Blade package say how to connect the template engine:
require 'vendor/autoload.php';
use Philo\Blade\Blade;
$views = __DIR__ . '/views';
$cache = __DIR__ . '/cache';
$blade = new Blade($views, $cache);
echo $blade->view()->make('hello')->render();
View::make('template');
Answer the question
In order to leave comments, you need to log in
Grab Blade with composer:
And then in code:
$blade = new \Philo\Blade\Blade("/path/to/blade/views", "/path/to/blade/cache");
echo $blade->view()->make('templateName', $params)->render(); //здесь как в laravel
function view($view, $params = []){
$blade = new \Philo\Blade\Blade("/path/to/blade/views", "/path/to/blade/cache");
$blade = $this->loadCompiler();
return $blade->view()->make($view, $params)->render();
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question