mustache.php

A Mustache implementation in PHP.

  • 所有者: bobthecow/mustache.php
  • 平台:
  • 许可证: MIT License
  • 分类:
  • 主题:
  • 喜欢:
    0
      比较:

Github星跟踪图

Mustache.php

A Mustache implementation in PHP.

Package version
Build status
StyleCI
Monthly downloads

Usage

A quick example:

<?php
$m = new Mustache_Engine;
echo $m->render('Hello {{planet}}', array('planet' => 'World!')); // "Hello World!"

And a more in-depth example -- this is the canonical Mustache template:

Hello {{name}}
You have just won {{value}} dollars!
{{#in_ca}}
Well, {{taxed_value}} dollars, after taxes.
{{/in_ca}}

Create a view "context" object -- which could also be an associative array, but those don't do functions quite as well:

<?php
class Chris {
    public $name  = "Chris";
    public $value = 10000;

    public function taxed_value() {
        return $this->value - ($this->value * 0.4);
    }

    public $in_ca = true;
}

And render it:

<?php
$m = new Mustache_Engine;
$chris = new Chris;
echo $m->render($template, $chris);

And That's Not All!

Read the Mustache.php documentation for more information.

See Also

主要指标

概览
名称与所有者bobthecow/mustache.php
主编程语言PHP
编程语言PHP (语言数: 1)
平台
许可证MIT License
所有者活动
创建于2010-03-19 10:58:58
推送于2025-06-28 18:37:45
最后一次提交
发布数52
最新版本名称v3.0.0 (发布于 2025-06-28 14:29:02)
第一版名称0.1 (发布于 2010-04-26 21:17:26)
用户参与
星数3.3k
关注者数114
派生数436
提交数0.9k
已启用问题?
问题数283
打开的问题数31
拉请求数60
打开的拉请求数2
关闭的拉请求数82
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?