xana/gen-html

This library make generating HTML contents easier than ever

1.0.2.8 2024-08-07 15:31 UTC

This package is auto-updated.

Last update: 2025-06-07 17:15:33 UTC


README

Downloads Contributors Forks Stargazers Issues MIT License LinkedIn


image

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.

(back to top)

Supports:

  1. 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
  2. CSS Framework
    • Bootstrap 5

(back to top)

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

(back to top)

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.

  1. Install the library
composer require xana/gen-html
  1. Have fun!

(back to top)

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();

(back to top)

Contact

📫 Omar SAKHRAOUI ( aka Xana )

(back to top)

Additional documentation

(back to top)

Made with 💕