xana / gen-html
This library make generating HTML contents easier than ever
Requires
- php: ^8
Requires (Dev)
README
HTML GEN
Generate your HTML securely, with ease!
Explore the docs »
Report Bug
·
Request Feature
Table of Contents
About The Project
This is a library that does just that; generates HTML markdown using fluent PHP classes. This library can be used anywhere where you can have PHP and HTML coexist. Worth noting, this library was made just for fun.
Supports:
- HTML Elements
Divs
Paragraphs
Images
Links
Inputs (text, mail, phone, passwoord, date, file, select...)
Tables (row, columns, header...)
Forms
Headings
Lists (ordered and unordered)
Line break
- CSS Framework
Bootstrap 5
Getting Started
To set up a local instance of the application, follow the steps below.
Prerequisites
The following dependencies are required to be installed for the project to function properly:
- PHP 8+
- Composer
Installation
Now that the environment has been set up and configured to properly compile and run the project, the next step is to install and configure the project locally on your system.
- Install the library
composer require xana/gen-html
- Have fun!
Usage
Use this space to show useful examples of how a project can be used. Additional screenshots, code examples and demos work well in this space.
use Xana\GenHtml\Elements\Button; use Xana\GenHtml\Elements\Email; use Xana\GenHtml\Elements\Form; use Xana\GenHtml\Elements\Password; use Xana\GenHtml\Elements\TextArea; require 'vendor/autoload.php'; $paragraphWithInlineLink = new Paragraph('A paragraph, but you can click {here} to visit example.com'); $paragraphWithInlineLink->addInlineElement('here', new link('//example.com', 'here')); $paragraphWithInlineLink->render(); $defaultAttrs = [ "required" => true, 'placeholder' => 'Enter your message here', ]; $form = $form->addElement(new Email("email", ["placeholder" => "Email Address", 'class'=>'bg-info'])->keepDefaultClasses()) ->addElement(new Password("password", ["placeholder" => "Password"])) ->addElement(new TextArea('the-text', $defaultAttrs)) ->addElement(new Button("Login")); echo $form->render();
Contact
📫 Omar SAKHRAOUI ( aka Xana )