Barebone\ZenPHP

Easy and fast HTML Block Builder

ZenPHP provides a powerful HTML block generator to speed up your PHP generated HTML.

ZenPHP help you to create HTML blocks with CSS-like selectors. HTML blocks are made using css syntax like div>p or div.post>h1>a[href=posts.php?id=%id%]{%title%}<p{%content%}. Read the cheatsheet for emmet to get a better undestanding of this.


$vars = array('id' => 1, 'title' => 'Post Title', 'content' => 'Post Content');
echo ZenPHP::expand('div.post>h1>a[href=posts.php?id=%id%]{%title%}<p{%content%}', $vars);
 

Result

Post Title

Post Content

HTML

<div class="post">
    <h1>
        <a href="posts.php?id=1">
            Post Title
        </a>
    </h1>
    <p>
        Post Content
    </p>
</div>