berry/html

No dependency, fast PHP eDSL for writing HTML

Fund package maintenance!
atomicptr
Buy Me A Coffee

Installs: 3

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/berry/html

v0.1.0 2025-12-27 14:32 UTC

This package is auto-updated.

Last update: 2025-12-27 14:45:19 UTC


README

No dependency, fast PHP eDSL for writing HTML

Define HTML templates using PHP without losing access to tools like phpstan and xdebug

Usage

Install via composer

$ composer req berry/html
<?php declare(strict_types=1);

namespace App\View;

use Berry\Renderable;

use function Berry\Html5\html;
use function Berry\Html5\head;
use function Berry\Html5\body;
use function Berry\Html5\div;

class IndexView
{
    public static function render(): Renderable
    {
        return html()
            ->lang('en')
            ->child(head()
                ->child(title()->text('Index Page')))
            ->child(body()
                ->child(
                    div()
                        ->class('container')
                        ->child(
                            h1()->text('Index Page')
                        )
                )
                ->child(
                    footer()->text('This is a footer')
                )
            );
    }
}

License

MIT