martynbiz/slim3-view

A wrapper for Slim3 renderer which uses Windwalker renderer (Blade, Twig, PHP etc)

dev-master 2016-02-11 03:07 UTC

This package is not auto-updated.

Last update: 2024-12-13 18:52:55 UTC


README

Introduction

A simple wrapper for Slim3 renderer which uses Windwalker renderer (Blade, Twig, PHP etc)

See the Windwalker renderer here - https://github.com/ventoviro/windwalker

Installation

Composer

"require-dev": {
    "martynbiz/slim3-view": "dev-master"
}

Usage

Below is an example usage within the slim3 skeleton app:

settings.php

$settings = [
    'settings' => [
        'renderer' => [
            'template_path' => '/path/to/views/',
            'cache_path' => '/path/to/cache/views',
        ],
        .
        .
        .

dependencies.php

// view renderer
$container['renderer'] = function ($c) {
    $settings = $c->get('settings')['renderer'];

    // choose your weapon.. :) e.g. Blade, Twig, etc
    $renderer = new \Windwalker\Renderer\BladeRenderer(array(
        $settings['template_path'],
    ), array(
        'cache_path' => $settings['cache_path'],
    ));

    return new \MartynBiz\Slim3View\Renderer($renderer);
};