2017 © Pedro Peláez
 

library php-library-html

PHP Library HTML

image

sinevia/php-library-html

PHP Library HTML

  • Tuesday, July 31, 2018
  • by sinevia
  • Repository
  • 1 Watchers
  • 1 Stars
  • 170 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 4 Versions
  • 467 % Grown

The README.md

PHP Library HTML

No Dependencies Tests Gitpod Ready-to-Code, (*1)

Programatically generate valid HTML., (*2)

Introduction

This library helps generate valid HTML/XHTML using PHP. It has most of the HTML elements, as well as additional elements like Webpage, BorderLayout, etc., (*3)

Installation

  1. Via Composer
composer require sinevia/php-library-html
  1. Manual Download this folder

Examples

1. Image

$image = (new \Sinevia\Html\Image)
        ->setUrl('http://help.jpg')->setAlt('Help')
        ->setOnClick('$("#info").toggle()')
        ->toXhtml();

2. Input

$inputFirstName = (new \Sinevia\Html\Input)
        ->setName('FirstName')
        ->setValue($firstName)
        ->setPlaceHolder('Your first name')
        ->addClass('form-control')
        ->toXhtml();

3. Select

  • Select editor list
echo (new Sinevia\Html\Select)
        ->addItems(App\Models\Articles\Article::getEditorList())
        ->setSelectedItem($wysiwyg)
        ->addClass('form-control')
        ->setName('Wysiwyg')
        ->toHtml();
  • Select Birthday Day/Month/Year
$selectBirthDay = (new \Sinevia\Html\Select)
        ->setName('BirthDay')
        ->setSelectedItem($birthDay)
        ->addClass('form-control')
        ->addItem("", "- Select day -")
        ->addItems(array_combine(range(1, 31), range(1, 31)))
        ->setSelectedItem($birthDay)
        ->toXhtml();

$selectBirthMonth = (new \Sinevia\Html\Select)
        ->setName('BirthMonth')
        ->addClass('form-control')
        ->addItem("", "- Select month -")
        ->addItems(array_combine(range(1, 12), array_map(function($v) {
                            return date('F', mktime(0, 0, 0, $v, 1));
                        }, range(1, 12))))
        ->setSelectedItem($birthMonth)
        ->toXhtml();

$selectBirthYear = (new \Sinevia\Html\Select)
        ->setName('BirthYear')
        ->addClass('form-control')
        ->addItem("", "- Select year -")
        ->addItems(array_combine(range(1930, 2020), range(1930, 2020)))
        ->setSelectedItem($birthYear)
        ->toXhtml();

4. Webpage

$webpage = (new \Sinevia\Html\Webpage)
        ->setTitle('Hello')
        ->addChild('Hello World');
echo $webpage->toHtml();

The Versions

31/07 2018

dev-master

9999999-dev http://github.com/sinevia/php-library-html

PHP Library HTML

  Sources   Download

proprietary

php library html sinevia

31/07 2018

v0.0.7

0.0.7.0 http://github.com/sinevia/php-library-html

PHP Library HTML

  Sources   Download

proprietary

php library html sinevia

29/07 2018

v0.0.6

0.0.6.0 http://github.com/sinevia/php-library-html

PHP Library HTML

  Sources   Download

proprietary

php library html sinevia

23/06 2018

v0.0.1

0.0.1.0 http://github.com/sinevia/php-library-html

PHP Library HTML

  Sources   Download

proprietary

php library html sinevia