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('Pricing Plans');
$site->description('Compare our pricing plans.');
$site->meta('charset', 'utf-8');
$site->responsive(true);

// Pricing container
$pricing = $site->body->div('.pricing');
$pricing->h1()->content('Choose Your Plan');

// Pricing table
$table = $pricing->div('.pricing-table');

// Plan 1
$plan1 = $table->div('.plan');
$plan1->h2()->content('Basic');
$plan1->p('.price')->content('$9.99/month');
$plan1->ul()
    ->li()->content('10 Projects')
    ->li()->content('5 GB Storage')
    ->li()->content('Basic Support');
$plan1->add('button .btn')->content('Sign Up');

// Plan 2
$plan2 = $table->div('.plan .featured');
$plan2->h2()->content('Pro');
$plan2->p('.price')->content('$19.99/month');
$plan2->ul()
    ->li()->content('Unlimited Projects')
    ->li()->content('50 GB Storage')
    ->li()->content('Priority Support');
$plan2->add('button .btn')->content('Sign Up');

// Plan 3
$plan3 = $table->div('.plan');
$plan3->h2()->content('Enterprise');
$plan3->p('.price')->content('$49.99/month');
$plan3->ul()
    ->li()->content('Unlimited Projects')
    ->li()->content('Unlimited Storage')
    ->li()->content('24/7 Support');
$plan3->add('button .btn')->content('Sign Up');

echo $site->html();

Output

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

<head>
    <title>Pricing Plans</title>
    <meta name="description" content="Compare our pricing plans." />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta name="charset" content="utf-8" />
</head>

<body>
    <div class="pricing">
        <h1>Choose Your Plan</h1>
        <div class="pricing-table">
            <div class="plan">
                <h2>Basic</h2>
                <p class="price">$9.99/month</p>
                <ul>
                    <li>10 Projects
                        <li>5 GB Storage
                            <li>Basic Support</li>
                        </li>
                    </li>
                </ul>
                <button class="btn">Sign Up</button>
            </div>
            <div class="plan featured">
                <h2>Pro</h2>
                <p class="price">$19.99/month</p>
                <ul>
                    <li>Unlimited Projects
                        <li>50 GB Storage
                            <li>Priority Support</li>
                        </li>
                    </li>
                </ul>
                <button class="btn">Sign Up</button>
            </div>
            <div class="plan">
                <h2>Enterprise</h2>
                <p class="price">$49.99/month</p>
                <ul>
                    <li>Unlimited Projects
                        <li>Unlimited Storage
                            <li>24/7 Support</li>
                        </li>
                    </li>
                </ul>
                <button class="btn">Sign Up</button>
            </div>
        </div>
    </div>
</body>

</html>