nijhof / html-builder
Typed HTML builder for PHP.
v0.1.0
2026-08-10 23:34 UTC
Requires
- php: ^8.3
Requires (Dev)
- phpstan/phpstan: ^2.1
- phpunit/phpunit: ^12.5
This package is not auto-updated.
Last update: 2026-08-11 23:08:05 UTC
README
Typed HTML builder for PHP.
HTML Builder provides small value objects and element classes for constructing escaped HTML in PHP code. It focuses on explicit element types, typed attributes, and safe text rendering.
Requirements
- PHP 8.3 or higher
Installation
composer require nijhof/html-builder
Example
<?php
declare(strict_types=1);
use Nijhof\Html\Elements\Div;
use Nijhof\Html\Text;
echo Div::of(Text::of('<content>'))->render();
Output:
<div><content></div>
Development
composer install
composer analyse
composer test
License
This package is licensed under the MIT License.