1. Go to this page and download the library: Download artem_c/emmet 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/ */
artem_c / emmet example snippets
$emmet = new Emmet('tr>td{`value`}');
foreach($data as $value){
echo $emmet->create([ 'value' => $value ]);
}
foreach($data as $value){
echo (new Emmet('tr>td{`value`}'))->create([ 'value' => $value ]);
}
'a+span' ==== '<a></a><span></span>'
'a>span' === '<a><span></span></a>'
`div+h1` === '<div></div><h1></h1>'
echo (new Emmet('ul>li{`ul[$]`}*2'))->create(['ul' => [1,2,3]]) === '<ul><li>1</li><li>2</li></ul>'
integer count( mixed ) // the same as 'count()' in php
strinf select($name, $selected, array $data, array $html_options = []) // creates Select HTML Element
Emmet::addFunctions(['htmlFunction' => function(){ return 'function html node';}])
echo (new Emmet('div>`htmlVar`+%htmlFunction()%'))->create(['htmlVar' => 'variable html node']) === '<div>variable html nodefunction html node</div>'
echo (new Emmet('div+`myP`>a+span'))->create(['myP' => '<p class="myP">{{value}}</p>']) === '<div></div><p class="myP"><a></a><span></span></p>'
Emmet::addFunction(['oneMoreP' => '<p class="one more p">{{value}}</p>']);
echo (new Emmet('div>%oneMoreP()%>`myP`>a+a'))->create(['myP' => '<p class="myP">{{value}}</p>']) === '<div><p class="one more p"><p class="myP"><a></a><a></a></p></p></div>'
Emmet::addFunction(['func' => function($first, $second, $value) { return $first.' '.$second.' '.$value; }]);
echo (new Emmet('div>%func(first, `second`)%>`second`+a'))->create(['second' => 'second']) ===
'<div>first second second<a></a></div>'
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.