eLife patterns

dev-master 2024-06-19 07:05 UTC

This package is auto-updated.

Last update: 2024-06-19 07:05:29 UTC


eLife Patterns

Build Status

This library provides a PHP implementation for the Mustache templates/assets produced by the eLife Sciences Pattern Library.



Execute composer require elife/patterns:dev-master.


This library is not versioned as the eLife Patterns can make breaking changes at any time. It's not expected to be used by libraries, but by applications where Composer lock files are used. These tie the application to a specific commit.


Create ViewModels and pass them to a PatternRenderer, which will return the rendered template.

For example:

use eLife\Patterns\PatternRenderer\MustachePatternRenderer;

$helpers = [
    'assetsPath' => '/path/to/assets',
    'assetRewrite' => function (string $path, Mustache_LambdaHelper $helper) : string {
        return $helper->render($path).'?cache-buster';

$mustache = new Mustache_Engine([
    'helpers' => $helpers,
    'loader' => new Mustache_Loader_FilesystemLoader('/path/to/patterns-php'),
$patternRenderer = new MustachePatternRenderer($mustache);


Updating the library

  1. Install Docker.
  2. Execute bin/update to update the resources folder from Pattern Lab (you can pass a commit or pull request if needed, eg bin/update 4303c0199112724bd5725537c7192828099018fb or bin/update pr-850).
  3. Make changes to the view models accordingly.