2017 © Pedro Peláez
 

library slim-blade-view

Blade for Slim Framework 3 with Custom Directive

image

buchin/slim-blade-view

Blade for Slim Framework 3 with Custom Directive

  • Wednesday, January 11, 2017
  • by buchin
  • Repository
  • 1 Watchers
  • 2 Stars
  • 173 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 4 Forks
  • 0 Open issues
  • 3 Versions
  • 2 % Grown

The README.md

Blade for Slim Framework 3

Usage

In index.php set up the blade container:, (*1)

$container = $app->getContainer();
$blade = new \Slim\Views\Blade(
    '/path/to/views/folder',
    '/path/to/cache/folder'
);

// [optional] insert custom directive here

$container['blade'] = $blade;

Example code to render index.blade.php in route:, (*2)

return $this->blade->render($response, 'index', $args);

Advanced: Custom directive:

$container = $app->getContainer();
$blade = new \Slim\Views\Blade(
    '/path/to/views/folder',
    '/path/to/cache/folder'
);

// example directive here, usage: @helloWorld
$blade->getRenderer()->getCompiler()->directive('helloWorld', function(){

    return "<?php echo 'Hello World'; ?>";
});

$container['blade'] = $blade;

$app->run();

If you like to build custom directive using $app:, (*3)


$app->getContainer()['blade']->getRenderer()->getCompiler()->directive('helloWorld', function(){ return "<?php echo 'Hello My Second World'; ?>"; });

The Versions

11/01 2017

dev-master

9999999-dev

Blade for Slim Framework 3 with Custom Directive

  Sources   Download

MIT

The Requires

 

The Development Requires

by Mochammad Masbuchin
by Hiroaki Matsuura

framework template blade renderer slim view

11/03 2016

0.1.1

0.1.1.0

Slim Framework 3 view helper built on the Blade component

  Sources   Download

MIT

The Requires

 

The Development Requires

by Hiroaki Matsuura

framework template blade renderer slim view

10/03 2016

0.1

0.1.0.0

Slim Framework 3 view helper built on top of the Blade component

  Sources   Download

MIT

The Requires

 

The Development Requires

by Hiroaki Matsuura

framework template blade renderer slim view