1. Go to this page and download the library: Download phy/markup 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/ */
phy / markup example snippets
use PHY\Markup\HTML5 as Markup;
/*
* Create an article tag with a class of "article".
*/
$markup = new Markup;
$article = $markup->article;
$article->class('article');
/*
* Use our HTML helper to create some elements for us.
*/
$helper = $markup->helper();
$url = $helper->url('Our Link\'s title!', [
'/rest.php',
'key' => 'value'
]);
/*
* Add some extra content to our article.
*/
$article
->append($markup->header($markup->h2('H2 Heading!'),['class' => 'header'))
->append($markup->section($markup->p('Inner P tag!')))
->append($markup->footer->append($url));
/*
* Recursively generate our HTML on echo.
* Produces: <article class="article"><header class="header"><h2>H2 Heading!</h2></header><section><p>Inner P tag!</p></section><footer><a href="/rest.php?key=value">Our Link's Title!</a></footer></article>
*/
echo $article;
/*
* Also, you can use the Markup::create('HTML5');
*/
use \PHY\Markup;
$markup = Markup::create('HTML5');
/*
* Now for some example usage of using the Markup class itself.
*/
var_dump($markup->isTagVoid('br'));
var_dump($markup->has('div'));
$markup->add('banana', [], true);
$markup->has('banana');
var_dump($markup->isTagVoid('banana'));
$markup->remove('canvas', 'height');
var_dump($markup->has('canvas', 'height'));
$markup->remove('video');
var_dump($markup->has('video'));
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.