承接 buchin/slim-blade-view 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 7
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-01-11