2017 © Pedro Peláez
 

library mustache

A Mustache implementation in PHP.

image

masked82/mustache

A Mustache implementation in PHP.

  • Monday, December 23, 2013
  • by masked82
  • Repository
  • 2 Watchers
  • 1 Stars
  • 523 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 383 Forks
  • 0 Open issues
  • 16 Versions
  • 0 % Grown

The README.md

Mustache.php

A Mustache implementation in PHP., (*1)

Build Status, (*2)

Additions

The view helpers now get access to the context object:, (*3)

<?php
$mustache = new Mustache_Engine(
    array(
        'helpers' => array(
            'displayName' => function($source, \Mustache_LambdaHelper $lambdaHelper, \Mustache_Context $context) {
                // Access the current context:
                $contextValue = $context->last();
                return isset($contextValue->name) ? $contextValue->name : '';
            },
            'changeName' => function($source, \Mustache_LambdaHelper $lambdaHelper, \Mustache_Context $context) {
                // Remove the current context:
                $contextValue = $context->pop();
                // Change the context value:
                $contextValue->name = 'New Name';
                // Save the context value
                $context->push($contextValue);
                return $lambdaHelper->render($source);
            },
        ),
    )
);

Usage

<?php
echo $mustache->render(
    'Name:
    {{#person}}
        <p>
            {{#displayName}}{{/displayName}}
        </p>
        <p>
            {{#changeName}}
                The name is changed, but the last name is still {{lastName}}.
            {{/changeName}}
        </p>
        <p>
            {{#displayName}}{{/displayName}}
        </p>
    {{/person}}',
    array(
        'person' => array(
            'name' => 'Some Name',
            'lastName' => 'Last Name'
        )
    )
);

The result would be:, (*4)

```html+jinja Name:, (*5)

Some Name The name is changed, but the last name is still Last Name. New Name, (*6)

```, (*7)

And That's Not All!

Read the Mustache.php documentation for more information., (*8)

The Versions

23/12 2013

dev-context

dev-context https://github.com/bobthecow/mustache.php

A Mustache implementation in PHP.

  Sources   Download

MIT

The Requires

  • php >=5.2.4

 

The Development Requires

templating mustache

23/12 2013

dev-master

9999999-dev https://github.com/bobthecow/mustache.php

A Mustache implementation in PHP.

  Sources   Download

MIT

The Requires

  • php >=5.2.4

 

The Development Requires

templating mustache

14/12 2013

dev-dev

dev-dev https://github.com/bobthecow/mustache.php

A Mustache implementation in PHP.

  Sources   Download

MIT

The Requires

  • php >=5.2.4

 

The Development Requires

templating mustache

14/12 2013

v2.5.0

2.5.0.0 https://github.com/bobthecow/mustache.php

A Mustache implementation in PHP.

  Sources   Download

MIT

The Requires

  • php >=5.2.4

 

The Development Requires

templating mustache

13/08 2013

v2.4.1

2.4.1.0 https://github.com/bobthecow/mustache.php

A Mustache implementation in PHP.

  Sources   Download

MIT

The Requires

  • php >=5.2.4

 

The Development Requires

templating mustache

13/08 2013

dev-feature/anchor-dot-context

dev-feature/anchor-dot-context https://github.com/bobthecow/mustache.php

A Mustache implementation in PHP.

  Sources   Download

MIT

The Requires

  • php >=5.2.4

 

The Development Requires

templating mustache

09/08 2013

dev-feature/template-inheritance

dev-feature/template-inheritance https://github.com/bobthecow/mustache.php

A Mustache implementation in PHP.

  Sources   Download

MIT

The Requires

  • php >=5.2.4

 

The Development Requires

templating mustache

18/07 2013

v2.4.0

2.4.0.0 https://github.com/bobthecow/mustache.php

A Mustache implementation in PHP.

  Sources   Download

MIT

The Requires

  • php >=5.2.4

 

templating mustache

25/04 2013

v2.3.1

2.3.1.0 https://github.com/bobthecow/mustache.php

A Mustache implementation in PHP.

  Sources   Download

MIT

The Requires

  • php >=5.2.4

 

templating mustache

02/04 2013

v2.3.0

2.3.0.0 https://github.com/bobthecow/mustache.php

A Mustache implementation in PHP.

  Sources   Download

MIT

The Requires

  • php >=5.2.4

 

templating mustache

25/03 2013

v2.2.0

2.2.0.0 https://github.com/bobthecow/mustache.php

A Mustache implementation in PHP.

  Sources   Download

MIT

The Requires

  • php >=5.2.4

 

templating mustache

12/01 2013

v2.1.0

2.1.0.0 https://github.com/bobthecow/mustache.php

A Mustache implementation in PHP.

  Sources   Download

MIT

The Requires

  • php >=5.2.4

 

templating mustache

12/09 2012

v2.0.2

2.0.2.0 https://github.com/bobthecow/mustache.php

A Mustache implementation in PHP.

  Sources   Download

MIT

The Requires

  • php >=5.2.4

 

templating mustache

12/09 2012

v2.0.1

2.0.1.0 https://github.com/bobthecow/mustache.php

A Mustache implementation in PHP.

  Sources   Download

MIT

The Requires

  • php >=5.2.4

 

templating mustache

09/07 2012

v2.0.0

2.0.0.0 https://github.com/bobthecow/mustache.php

A Mustache implementation in PHP.

  Sources   Download

MIT

The Requires

  • php >=5.2.4

 

templating mustache

13/06 2012

v2.0.0-rc.1

2.0.0.0-RC1 https://github.com/bobthecow/mustache.php

A Mustache implementation in PHP.

  Sources   Download

MIT

The Requires

  • php >=5.2.4

 

templating mustache