承接 andrewslince/slim3-mustache-view 相关项目开发

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

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

andrewslince/slim3-mustache-view

最新稳定版本:1.0.5

Composer 安装命令:

composer require andrewslince/slim3-mustache-view

包简介

PHP Mustache view class for Slim 3 Framework

README 文档

README

Build Status Latest Stable Version Scrutinizer Code Quality License

A PHP Mustache class for render views on Slim 3 Framework.

Requirements

  • Slim 3.0.0 or newer;
  • PHP 5.6 or newer.

Install

Via Composer:

$ composer require andrewslince/slim3-mustache-view

Usage

<?php

$app = new \Slim\App([
    // your application settings
]);

// get application container
$container = $app->getContainer();

// register view template engine and configurations
$container['renderer'] = function () {
    return new \Slim\Views\Mustache([

        // REQUIRED
        'template' => [

            // REQUIRED
            'paths' => [
                realpath('./templates')
            ],

            // optional
            'extension' => 'html',

            // optional
            'charset' => 'utf-8',
        ],

        // put other mustache options here¹
    ]);
};

// use the render() method in your application routes
$app->get('/', function ($request, $response, $args) {

    // render your view
    return $this->renderer->render(
        $response,
        'index',
        $args
    );
});

$app->run();

NOTES:

¹ See other Mustache options here.

Testing

To running unit tests, executes the command below:

./vendor/bin/phpunit -c phpunit.xml.dist

Contributing

Please see CONTRIBUTING for details.

Credits

License

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

统计信息

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

GitHub 信息

  • Stars: 4
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-11-20