Skip to content

Instantly share code, notes, and snippets.

@yancya
Last active June 26, 2020 13:45
Show Gist options
  • Save yancya/1799ed81840950ddfbcd9574cf3fddb4 to your computer and use it in GitHub Desktop.
Save yancya/1799ed81840950ddfbcd9574cf3fddb4 to your computer and use it in GitHub Desktop.
謎の HAML ライブラリを使う方法
{
"name": "yancya/php_sandbox",
"authors": [
{
"name": "yancya",
"email": "yancya@upec.jp"
}
],
"require": {
"mthaml/mthaml": "*"
}
}
<?php
require __DIR__ . '/vendor/autoload.php';
$haml = new MtHaml\Environment('php');
$executor = new MtHaml\Support\Php\Executor($haml, array(
'cache' => sys_get_temp_dir().'/haml',
));
// Compiles and executes the HAML template, with variables given as second
// argument
$executor->display('template.haml', array(
'message' => 'Hello',
));
php hoge.php
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php composer-setup.php
composer install
%ul#message
%li.message
=$message
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment