PHP code example of haml / haml

1. Go to this page and download the library: Download haml/haml 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/ */

    

haml / haml example snippets

 php
<ul id="users">
   foreach($users as $user) { 
 php

$haml = new MtHaml\Environment('php');
$compiled = $haml->compileString($haml_template, "filename");
 php

$haml = new MtHaml\Environment('twig', array('enable_escaper' => false));
$compiled = $haml->compileString($haml_template, "filename");

// Register the MtHaml extension before executing the template:
$twig->addExtension(new MtHaml\Support\Twig\Extension());
$twig->render(...);
 php
Email  echo htmlspecialchars($user->getEmail(), ENT_QUOTES, 'UTF-8'); 
 php


$haml = new MtHaml\Environment(...);

$twig_loader = new Twig_Loader_Filesystem(...);
$twig_loader = new MtHaml\Support\Twig\Loader($twig_loader);
 php

// Register the MtHaml extension before executing the template:
$twig->addExtension(new MtHaml\Support\Twig\Extension());
$twig->render("rendered_twig_template.twig");
 php


$coffeeFilter = new MtHaml\Filter\CoffeeScript(new CoffeeScript\Compiler);

$env = new MtHaml\Environment('twig', array(
    'enable_escaper' => false,
), array(
    'coffee' => $coffeeFilter,
));