Download the PHP package webfiori/ui without Composer
On this page you can find all versions of the php package webfiori/ui. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package ui
WebFiori UI
A PHP library for creating HTML documents and DOM manipulation with an object-oriented approach.
Motivations
PHP's built-in DOMDocument works but has friction for HTML generation:
- Verbose — Creating a styled element with text takes 4-5 lines. This library does it in one:
new HTMLNode('div', ['class' => 'x'])->text('hello') - No chaining —
DOMDocumentreturns void on most mutations. This library is fluent. - HTML5 issues —
DOMDocumentis XML-based (libxml2), throws warnings on HTML5 tags, and mishandles void elements - No templates — No built-in support for loading partial HTML with variable slots
- Limited output control —
saveHTML()gives little control over formatting, quoting, or self-closing tags
This library's sweet spot is generating HTML from PHP — pages, emails, components — where a builder pattern and template system give better DX than the W3C DOM API.
This is a DOM builder, not a text-based template engine. If you need template inheritance, compiled templates, or a dedicated syntax (like Blade or Twig), use those instead. Use this library when you want to construct and manipulate HTML programmatically — server-rendered components, email generation, PDF markup, or any case where the structure is driven by logic rather than a layout file.
Table of Contents
- Key Features
- Supported PHP Versions
- Installation
- Quick Start
- Usage
- HTML Document Creation
- Working with Elements
- Forms and Input
- Tables and Data
- Template System
- API Reference
- Testing
- Contributing
- License
- Support
- Changelog
Key Features
- Object-Oriented DOM Creation — Build HTML elements using intuitive PHP classes
- Template System — Support for both HTML templates with slots and PHP templates
- Iterator Support — Traverse child nodes using foreach loops
- Type Safety — Full type hints and comprehensive PHPDoc documentation
- Security First — Built-in HTML entity escaping in attribute values
- XML Support — Generate both HTML and XML documents
- Standalone Renderer —
HtmlRendererwith per-instance config, safe for async contexts
Supported PHP Versions
| Build Status |
|---|
Installation
Quick Start
Usage
HTML Document Creation
Working with Elements
Forms and Input
Tables and Data
Template System
HTML templates with slots:
PHP templates with variables:
API Reference
Core Classes
| Class | Description |
|---|---|
HTMLNode |
Foundation class for all HTML elements |
HTMLDoc |
Represents a complete HTML document |
HeadNode |
The HTML head section |
HTMLTable |
Table creation and manipulation |
HtmlRenderer |
Standalone renderer with per-instance config |
TemplateCompiler |
HTML/PHP template loading and compilation |
Key Methods (HTMLNode)
| Method | Description |
|---|---|
addChild($node, $attrs) |
Add a child element |
setAttribute($name, $val) |
Set an attribute |
text($text) |
Set text content |
toHTML($formatted) |
Render to HTML string |
toXML($formatted) |
Render to XML string |
fromFile($path, $vars) |
Load from template |
fromFileAsDocument($path, $vars) |
Load as HTMLDoc |
fromFileAsNode($path, $vars) |
Load as single node |
fromFileAsArray($path, $vars) |
Load as node array |
Testing
Contributing
We welcome contributions! Please see our Contributing Guide for details.
- Clone the repository
- Install dependencies:
composer install - Run tests:
cd tests && php ../vendor/bin/phpunit - Check code style:
composer fix-cs
License
This library is licensed under the MIT License. See the LICENSE file for details.
Support
If you encounter any issues, please open an issue on GitHub.
Changelog
See Releases for version history.