Fork of rubellum/Slim-Blade-View with Slim Framework v4 and Laravel Blade Templates v8 support

v1.0.0 2021-07-05 15:04 UTC

This package is not auto-updated.

Last update: 2022-05-24 18:22:25 UTC


A fork of rubellum/Slim-Blade-View with the following changes:

  • Slim Framework v4 support
  • Laravel Blade Templates v8

This is a Slim Framework view helper built on top of the Blade component.

You can use this component to create and render templates in your Slim Framework application.


Via Composer

$ composer require berrnd/slim-blade-view

Requires Slim Framework 4 and PHP 7.2.0 or newer.


// Slim Settings
$config = [
    'settings' => [
        'displayErrorDetails' => true, // set to false in production

        // Renderer settings
        'renderer'            => [
            'blade_template_path' => 'path/to/views', // String or array of multiple paths
            'blade_cache_path'    => 'path/to/cache', // Mandatory by default, though could probably turn caching off for development

// Create Slim app
$app = new \Slim\App($config);

// Fetch DI Container
$container = $app->getContainer();

// Register Blade View helper
$container['view'] = function ($container) {
    return new \Slim\Views\Blade(

// Define named route
$app->get('/hello/{name}/', function ($request, $response, $args) {
    return $this->view->render($response, 'profile', [
        'name' => $args['name'],

// Run app


$ phpunit


The MIT License (MIT). Please see License File for more information.