Last active
June 26, 2020 13:45
-
-
Save yancya/1799ed81840950ddfbcd9574cf3fddb4 to your computer and use it in GitHub Desktop.
謎の HAML ライブラリを使う方法
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "yancya/php_sandbox", | |
"authors": [ | |
{ | |
"name": "yancya", | |
"email": "[email protected]" | |
} | |
], | |
"require": { | |
"mthaml/mthaml": "*" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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', | |
)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
php hoge.php |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" | |
php composer-setup.php | |
composer install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%ul#message | |
%li.message | |
=$message |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment