buchin/slim-blade-view
最新稳定版本:0.1.1
Composer 安装命令:
composer require buchin/slim-blade-view
包简介
Blade for Slim Framework 3 with Custom Directive
README 文档
README
Usage
In index.php set up the blade container:
$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:
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:
$app->getContainer()['blade']->getRenderer()->getCompiler()->directive('helloWorld', function(){ return "<?php echo 'Hello My Second World'; ?>"; });
统计信息
- 总下载量: 19.32k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 1
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-01-11