LOHTML

LOHTML is an easy-to-use PHP library that allows you to generate and manage HTML documents and websites programmatically with a fluent, chainable syntax. It helps you write clean, readable, and maintainable code by replacing manual HTML string concatenation or complex templating systems.

In short, it’s a PHP-powered HTML builder that simplifies creating and modifying HTML structures. This webpage is built using LOHTML.

LOHTML Demo

Input

Refresh the webpage to see a new example.

<?php

require_once('lohtml.php');

$site = new LOHTML();

// Configure the document
$site->language('en');
$site->title('My Blog Post');
$site->description('A sample blog post built with LOHTML.');
$site->meta('charset', 'utf-8');
$site->responsive(true);

// Blog post container
$post = $site->body->article('.blog-post');
$post->header()
    ->h1()->content('How to Build Websites with LOHTML')
    ->p()->content('By Lăcașuri Ortodoxe | Published on July 1, 2026');

$post->div('.content')
    ->p()->content('LOHTML is a powerful PHP library for building HTML documents programmatically.')
    ->p()->content('In this post, we will explore how to use LOHTML to create dynamic and maintainable websites.');

$post->footer()
    ->p()->content('Tags: ')
    ->a('#php')->content('PHP')->parent()
    ->text()->content(', ')
    ->a('#html')->content('HTML')->parent()
    ->text()->content(', ')
    ->a('#webdev')->content('Web Development');

echo $site->html();

Output

<!DOCTYPE html>
<html lang="en">

<head>
    <title>My Blog Post</title>
    <meta name="description" content="A sample blog post built with LOHTML." />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta name="charset" content="utf-8" />
</head>

<body>
    <article class="blog-post">
        <header>
            <h1>How to Build Websites with LOHTML<p>By Lăcașuri Ortodoxe | Published on July 1, 2026</p></h1>
        </header>
        <div class="content">
            <p>LOHTML is a powerful PHP library for building HTML documents programmatically.
                <p>In this post, we will explore how to use LOHTML to create dynamic and maintainable websites.</p>
            </p>
        </div>
        <footer>
            <p>Tags: <a href="#php">PHP</a>, <a href="#html">HTML</a>, <a href="#webdev">Web Development</a>
            </p>
        </footer>
    </article>
</body>

</html>