2017 © Pedro Peláez
 

library html

Object oriented tool for building HTML documents.

image

valerian/html

Object oriented tool for building HTML documents.

  • Wednesday, December 21, 2016
  • by miroslav-valerian
  • Repository
  • 1 Watchers
  • 0 Stars
  • 8 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

Html

Object oriented tool for building HTML documents., (*1)

Requirements

Requires PHP 5.6.0 or higher., (*2)

Installation

The best way to install valerian/html is using Composer:, (*3)

$ composer require valerian/html

Getting Started

Html, (*4)

$element = (new Valerian\Html\Html())
    ->attribute('class', 'foo')
    ->attribute('id', 'bar')
    ->addChild(...)
echo (string) $element;

Output:, (*5)

<html class="foo" id="bar"></html>

Body, (*6)

$element = (new Valerian\Html\Body())
    ->attribute('class', 'foo')
    ->attribute('id', 'bar')
    ->addChild(...)
echo (string) $element;

Output:, (*7)

<body class="foo" id="bar"></body>

Div, (*8)

$element = (new Valerian\Html\Div())
    ->attribute('class', 'foo')
    ->attribute('id', 'bar')
    ->addChild(...)
echo (string) $element;

Output:, (*9)

<div class="foo" id="bar"></div>

Span, (*10)

$element = (new Valerian\Html\Span())
    ->attribute('class', 'foo')
    ->attribute('id', 'bar')
    ->addChild(...)
echo (string) $element;

Output:, (*11)

<span class="foo" id="bar"></span>

Paragraph, (*12)

$element = (new Valerian\Html\Paragraph())
    ->attribute('class', 'foo')
    ->attribute('id', 'bar')
    ->addChild(...)
echo (string) $element;

Output:, (*13)

<p class="foo" id="bar"></p>

Image, (*14)

$element = (new Valerian\Html\Img('image url'))
    ->alt('alt text')
    ->width(100)
    ->height(200)
    ->attribute('class', 'foo')
    ->attribute('id', 'bar')
echo (string) $element;

Output:, (*15)

<img src="image url" alt="alt text" width="100" height="200" class="foo" id="bar">

Input, (*16)

$input = (new Valerian\Html\Input('text', 'foo'))
    ->value('bar')
    ->attribute('class', 'foo')
    ->attribute('id', 'bar')
echo (string) $input;

Output:, (*17)

<input type="text" name="foo" value="bar" class="foo" id="bar">

Select, (*18)

$select = (new Valerian\Html\Select('foo'))
    ->addOption(
        (new \Valerian\Html\SelectOption(1, 'Option 1'))
            ->disabled('disabed')
    )
    ->addOption(
        (new \Valerian\Html\SelectOption(2, 'Option 2'))
    )
    ->attribute('class', 'foo')
    ->attribute('id', 'bar')
echo (string) $select;

Output:, (*19)

<select name="foo" value="bar" class="foo" id="bar">
    <option value="1" disabled="disabed">Option 1</option>
    <option value="2">Option 2</option>
</select>

Form, (*20)

$input = (new Valerian\Html\Form('#'))
    ->method('GET')
    ->attribute('class', 'foo')
    ->attribute('id', 'bar')
    ->addChild($input)
    ->addChild($select)
echo (string) $input;

Output:, (*21)

<form action="#" method="GET" class="foo" id="bar">
    <input type="text" name="foo" value="bar" class="foo" id="bar">
    <select name="foo" value="bar" class="foo" id="bar">
        <option value="1" disabled="disabed">Option 1</option>
        <option value="2">Option 2</option>
    </select>
</form>

The Versions

21/12 2016

dev-master

9999999-dev

Object oriented tool for building HTML documents.

  Sources   Download

GPL-3.0 BSD-3-Clause GPL-2.0

The Requires

  • php >=5.6.0

 

The Development Requires

21/12 2016

v0.0.3

0.0.3.0

Object oriented tool for building HTML documents.

  Sources   Download

GPL-3.0 BSD-3-Clause GPL-2.0

The Requires

  • php >=5.6.0

 

The Development Requires

21/12 2016

v0.0.2

0.0.2.0

Object oriented tool for building HTML documents.

  Sources   Download

GPL-3.0 BSD-3-Clause GPL-2.0

The Requires

  • php >=5.6.0

 

The Development Requires

21/12 2016

v0.0.1

0.0.1.0

Object oriented tool for building HTML documents.

  Sources   Download

GPL-3.0 BSD-3-Clause GPL-2.0

The Requires

  • php >=5.6.0

 

The Development Requires