PHP code example of jbboehr / php-mustache

1. Go to this page and download the library: Download jbboehr/php-mustache library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

jbboehr / php-mustache example snippets



$mustache = new Mustache();
$tmpl = <<<EOF
Hello {{name}}
You have just won {{value}} dollars!
{{#in_ca}}
Well, {{taxed_value}} dollars, after taxes.
{{/in_ca}}
EOF;
$data = array(
  'name' => 'John',
  'value' => 10000,
  'taxed_value' => 10000 * 0.6,
  'in_ca' => true,
);
$partials = array();
echo $mustache->render($tmpl, $data, $partials);
sh
pie install jbboehr/php-mustache
nix
{
  inputs.php-mustache.url = "github:jbboehr/php-mustache";

  outputs = {php-mustache, ...}: let
    system = "x86_64-linux";
    mustache = php-mustache.packages.${system}.default;
  in {
    packages.${system}.default = mustache.php.buildEnv {
      extensions = ({enabled, ...}: enabled ++ [mustache]);
    };
  };
}