Download the PHP package pattern-lab/patternengine-mustache without Composer

On this page you can find all versions of the php package pattern-lab/patternengine-mustache. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package patternengine-mustache

license Packagist Gitter

Mustache PatternEngine for Pattern Lab PHP

The Mustache PatternEngine allows you to use Mustache as the template language for Pattern Lab PHP. Once the PatternEngine is installed you can use Mustache-based StarterKits and StyleguideKits.

Installation

The Mustache PatternEngine will come pre-installed with the Pattern Lab Standard Edition.

Composer

Pattern Lab PHP uses Composer to manage project dependencies with Pattern Lab Editions. To add the Mustache PatternEngine to the dependencies list for your Edition you can type the following in the command line at the base of your project:

composer require pattern-lab/patternengine-mustache

See Packagist for information on the latest release.

Overview

This document is broken into two parts:

Extending Mustache

Mustache comes with two ways to extend the underlying template parser:

The Mustache PatternEngine enables these features via Helpers.

Helpers

The requirements for using helpers with Pattern Lab:

An example function called verbatim.helper.mustache in ./source/_mustache-components/helpers:

This helper would be used like this in a pattern. Note that the tag is using the filename and that this is an example of a lambda:

Mustache also allows dot notation with helpers. An example function called case.helper.mustache in ./source/_mustache-components/helpers:

This helper would be used like this in a pattern. Note that the tag is using the filename and that this is an example of a filter:

Available Loaders

If you're building a plugin that will be parsing Mustache files you have access to three loaders. It's recommended that you use these instead of accessing Mustache directly as these loaders will work with other PatternEngines.

The String Loader

The string loader takes a simple string and compiles it. To use:

The Filesystem Loader

The filesystem loader will look for templates in the configured StyleguideKit directory and compile them. The template location for the filesystem loader can't be modified. To use:

The Pattern Loader

The pattern loader looks for patterns and allows the use of the Pattern Lab-specific partial syntax. To use:


$data                  = array(...);
$patternContent        = file_get_contents("path/to/pattern");
$patternEngineBasePath = \PatternLab\PatternEngine::getInstance()->getBasePath();
$patternLoaderClass    = $patternEngineBasePath."\Loaders\PatternLoader";
$patternLoader         = new $patternLoaderClass($options);
$code                  = $patternLoader->render(array("pattern" => $patternContent, "data" => $data));
print $output; // outputs the given pattern

All versions of patternengine-mustache with dependencies

PHP Build Version
Package Version
Requires pattern-lab/core Version ^2.0.0
mustache/mustache Version ~2.6
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package pattern-lab/patternengine-mustache contains the following files

Loading the files please wait ....