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?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?