berrnd/slim-blade-view 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

berrnd/slim-blade-view

最新稳定版本:v1.2.1

Composer 安装命令:

composer require berrnd/slim-blade-view

包简介

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

README 文档

README

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

  • Slim Framework v4 support
  • Laravel Blade Templates v11

Original README:

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.

Install

Via Composer

$ composer require berrnd/slim-blade-view

Requires Slim Framework 4 and PHP 7.2.0 or newer.

Usage

// 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(
        $container['settings']['renderer']['blade_template_path'],
        $container['settings']['renderer']['blade_cache_path']
    );
};

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

// Run app
$app->run();

Testing

$ phpunit

License

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

统计信息

  • 总下载量: 12.83k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 7
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-07-05