PHP code example of sinevia / php-library-html

1. Go to this page and download the library: Download sinevia/php-library-html library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

sinevia / php-library-html example snippets


echo (new Sinevia\Html\Select)
        ->addItems(App\Models\Articles\Article::getEditorList())
        ->setSelectedItem($wysiwyg)
        ->addClass('form-control')
        ->setName('Wysiwyg')
        ->toHtml();

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

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