2017 © Pedro Peláez
 

library very-simple-html-writer

This is a very simple HTML writer

image

yivi/very-simple-html-writer

This is a very simple HTML writer

  • Monday, July 2, 2018
  • by yivi
  • Repository
  • 1 Watchers
  • 0 Stars
  • 23 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

VerySimpleHtmlWriter

No safety belt. No speed limit. No parachute. No nothing. This is an HTML party and sanitizers and error checkers are not invited. XSS gallore!, (*1)

I wanted a quick way to generate HTML for a simple project. You shouldn't be using this anywhere unless you know what you are doing and why you are doing it. Even then, you shouldn't., (*2)

Usage (very alpha, much changing):

$writer        = new HtmlWriterService();
$main_layout   = $writer->layout('main');

$openBody      = $writer->tag('body')->leaveOpen();
$title         = $writer->fragment('hello, world!');
$h1            = $writer->tag('h1')->content($title);

$main_layout->addParts($openBody, $h1);

$ul_nav        = $writer->tag('ul')
                      ->attribute('role', 'navigation')
                      ->addClass('navigation')
                      ->id('navigation');

$nav_li_layout = $writer->layout('nav');

$li_home       = $writer->tag('li')->content($writer->fragment('Home'));
$li_contact    = $writer->tag('li')->content($writer->fragment('Contact'));
$li_about      = $writer->tag('li')->content($writer->fragment('About'));

$nav_li_layout->addParts($li_home, $li_contact, $li_about);

$ul_nav->content($nav_li_layout);

$closeBody     = $writer->tag('body')->justClose();

$main_layout->addParts($ul_nav, $closeBody)

echo $main_layout->compile();

The Versions

02/07 2018

dev-master

9999999-dev

This is a very simple HTML writer

  Sources   Download

GPL-3.0-or-later

The Requires

  • php ^7.1

 

The Development Requires

by Avatar yivi

11/04 2018

0.1.0

0.1.0.0

This is a very simple HTML writer

  Sources   Download

GPL-3.0-or-later

The Requires

  • php ^7.1

 

by Avatar yivi

28/03 2018

0.0.6

0.0.6.0

This is a very simple HTML writer

  Sources   Download

GPL-3.0-or-later

The Requires

  • php ^7.1

 

by Avatar yivi