hashchange/slim-legacy-mustache

Mustache support for Slim 1.x, backward compatible with PHP 5.2

2.0.0 2012-09-10 00:38 UTC

This package is not auto-updated.

Last update: 2024-04-13 12:53:45 UTC


README

Slim is a micro PHP 5 framework that helps you quickly write simple yet powerful RESTful web applications. Its 1.x branch is backward compatible with PHP 5.2.

This repository contains a custom Mustache view for Slim 1.x, offering full support for Mustache.php.

Where it differs from the "official" repo

Mustache support for Slim is provided by a single class. It is based on the Mustache view contained in Slim-Extras, but is customized in a number of ways.

Functional differences:

  • This version of the class is compatible with PHP 5.2 and does not use namespaces.
  • The class allows an object to be used as view data, thus enabling the use of Mustache lambdas in PHP 5.2. The version in the official repo only supports arrays.

Implementation details:

  • The class requires Slim 1.x and won't work with Slim 2.x (use Slim-Extras for that). It extends Slim_View, not \Slim\View.
  • The class is called View_Mustache, not Mustache. It has been renamed to avoid conflicts in the absence of namespaces.

Otherwise, it is used in the exact same way as the class provided with Slim-Extras. See there for usage notes.

Installation

Slim-Legacy-Mustache is best installed with Composer and is available from Packagist as "hashchange/slim-legacy-mustache".

The following setup in composer.json will install Slim and Mustache for PHP 5.2 in one go:

{
    "require": {
        "slim/slim": "1.*",
        "hashchange/slim-legacy-mustache": "*",
        "mustache/mustache": "2.*"
    }
}

Version

The current version is based on Mustache.php @ b12fdd0 in Slim-Extras 2.0.3-develop, last updated on 19 Jan 2013. It was tested with Slim 1.6.7.

Related

Slim

Primary Slim repo
Primary Slim-Extras repo
Slim website

Mustache

Primary Mustache.php repo
Mustache.php wiki
Mustache website

Open Source License

The resources in this repository are released under the MIT public license.

http://www.slimframework.com/license