2017 © Pedro Peláez
 

library html

Simple library for html rendering

image

netzmacht/html

Simple library for html rendering

  • Friday, September 22, 2017
  • by netzmacht
  • Repository
  • 2 Watchers
  • 3 Stars
  • 8,923 Installations
  • PHP
  • 12 Dependents
  • 0 Suggesters
  • 1 Forks
  • 2 Open issues
  • 12 Versions
  • 6 % Grown

The README.md

HTML helper library

Build Status Version License Downloads, (*1)

This library is a PHP helper library for creating HTML output., (*2)

Install

This extension can be installed using Composer, (*3)

composer require netzmacht/html:^3.0, (*4)

Requirements

PHP ^8.1, (*5)

Basic Usage

Define the attributes in the View:, (*6)

Attributes


$attributes = new Netzmacht\Html\Attributes(); $attributes ->setId('a_id') ->addClass('a_class') ->setAttribute('data-target', '#some');

This library uses the magic __toString to converts the helper objects to string. Outputting is really simple now:, (*7)




>Label This is a paragraph.

Of course you can change the attributes before generating, (*8)




setId('second')->removeClass('a_class')->addClass('new_class'); ?>>the content

Elements

Of course you can create the whole element as well. The library knows about standalone html elements which can't have any children and nodes which have children. Notice that the css classes are passed as array., (*9)


$factory = new Netzmacht\Html\Factory\ElementFactory(); $paragraph = $factory->create('p', array('id' => 'a_id', 'class' => array('description')); $label = $factory->create('span'); $label ->addClass('label') ->addChild('Label this'); $paragraph ->addChild('This is a paragraph.') ->addChild(' '); // add space between both elements ->addChild($label, Netzmacht\Html\Element\Node::POSITION_FIRST); // add at first position

Now you can output the whole element:, (*10)


<article> <?= $paragraph; ?> </article>

The Versions

22/09 2017

dev-master

9999999-dev

Simple library for html rendering

  Sources   Download

LGPL-3.0+

The Requires

  • php >=7.1

 

The Development Requires

helper html

22/09 2017

dev-hotfix/2.0.1

dev-hotfix/2.0.1

Simple library for html rendering

  Sources   Download

LGPL-3.0+

The Requires

  • php >=7.1

 

The Development Requires

helper html

22/09 2017

2.0.1

2.0.1.0

Simple library for html rendering

  Sources   Download

LGPL-3.0+

The Requires

  • php >=7.1

 

The Development Requires

helper html

13/09 2017

dev-develop

dev-develop

Simple library for html rendering

  Sources   Download

LGPL-3.0+

The Requires

  • php >=7.1

 

The Development Requires

helper html

13/09 2017

2.0.0

2.0.0.0

Simple library for html rendering

  Sources   Download

LGPL-3.0+

The Requires

  • php >=7.1

 

The Development Requires

helper html

13/09 2017

2.0.0-beta2

2.0.0.0-beta2

Simple library for html rendering

  Sources   Download

LGPL-3.0+

The Requires

  • php >=7.1

 

The Development Requires

helper html

13/09 2017

2.0.0-beta1

2.0.0.0-beta1

Simple library for html rendering

  Sources   Download

LGPL-3.0+

The Requires

 

The Development Requires

helper html

21/10 2016

1.2.1

1.2.1.0

Simple library for html rendering

  Sources   Download

LGPL-3.0+

The Requires

  • php >=5.3

 

The Development Requires

helper html

16/10 2014

1.2.0

1.2.0.0

Simple library for html rendering

  Sources   Download

LGPL-3.0+

The Requires

  • php >=5.3

 

The Development Requires

helper html

21/07 2014

1.1.0

1.1.0.0

Simple library for html rendering

  Sources   Download

LGPL-3.0+

The Requires

  • php >=5.3

 

The Development Requires

helper html

23/06 2014

1.0.1

1.0.1.0

Simple library for html rendering

  Sources   Download

LGPL-3.0+

The Requires

 

The Development Requires

helper html

20/06 2014

1.0.0

1.0.0.0

Simple library for html rendering

  Sources   Download

LGPL-3.0+

The Requires

 

The Development Requires

helper html