PHP Classes

PHP HTML Class Library: Compose HTML documents with tag classes

Recommend this page to a friend!
  Info   View files Example   Screenshots Screenshots   View files View files (31)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 90 This week: 1All time: 9,926 This week: 560Up
Version License PHP version Categories
html-in-php 1.0.0MIT/X Consortium ...7.3HTML, PHP 5, Traits
Description 

Author

This package can compose HTML documents with tag classes.

It provides several classes and traits specialized in generating several types of HTML tags by taking parameters during the creation of those class objects and using functions to combine tags that are contained inside each other.

Currently the package provides classes for generating HTML tags like table, div and span.

Picture of Piotr Synowiec
Name: Piotr Synowiec <contact>
Classes: 1 package by
Country: Poland Poland
Age: 53
All time rank: 4423102 in Poland Poland
Week rank: 416 Up12 in Poland Poland Up

Example

<?php
declare(strict_types=1);

require_once
__DIR__ . '/../vendor/autoload.php';

use
Mysiar\Html\Table\Caption;
use
Mysiar\Html\Simple\Div;
use
Mysiar\Html\Table\Table;
use
Mysiar\Html\Table\Tbody;
use
Mysiar\Html\Table\Td;
use
Mysiar\Html\Table\Tfoot;
use
Mysiar\Html\Table\Thead;
use
Mysiar\Html\Table\Tr;

$table = new Table(['class' => 'table table-striped table-bordered table-hover']);
$caption = new Caption('Symfony end of support');
$table->setCaption($caption);

$thead = new Thead();
$tbody = new Tbody();
$tfoot = new Tfoot();

$tr = new Tr(['class' => 'info']);
$td1 = new Td('Release');
$td2 = new Td('End of support');
$tr->setTds([$td1, $td2]);
$thead->addTr($tr);
$tfoot->addTr($tr);

$tr = new Tr(['class' => 'danger']);
$td1 = new Td('Symfony 2.8');
$td2 = new Td('November 2019');
$tr->setTds([$td1, $td2]);
$tbody->addTr($tr);

$tr = new Tr(['class' => 'success']);
$td1 = new Td('Symfony 3.4');
$td2 = new Td('November 2021');
$tr->setTds([$td1, $td2]);
$tbody->addTr($tr);

$tr = new Tr(['class' => 'success']);
$td1 = new Td('Symfony 4.4');
$td2 = new Td('November 2023');
$tr->setTds([$td1, $td2]);
$tbody->addTr($tr);

$tr = new Tr(['class' => 'warning']);
$td1 = new Td('Symfony 5.0');
$td2 = new Td('July 2020');
$tr->setTds([$td1, $td2]);
$tbody->addTr($tr);

$table->setThead($thead);
$table->setTbody($tbody);
$table->setTfoot($tfoot);

$div = new Div((string)$table, ['class' => 'col-md-6 col-md-offset-3']);
$divRow = new Div((string)$div, ['class' => 'row']);
$divContainer = new Div((string)$divRow, ['class' => 'container']);


print_r((string)$divContainer);


Details

Mysiar\Html

PHP classes for HTML

master codecov Latest Stable Version Total Downloads Latest Unstable Version License FOSSA Status

<hr>

Tags implemented

  • `<span>`
  • `<div>`
  • `<table>` * `<caption>` * `<tbody>` * `<thead>` * `<tfoot>` * `<tr>` * `<td>`

Example

Example.png


Screenshots  
  • Example.png
  Files folder image Files  
File Role Description
Files folder image.github (1 directory)
Files folder imageexamples (3 files)
Files folder imagesrc (2 files, 3 directories)
Files folder imagetests (2 directories)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file Makefile Data Auxiliary data
Accessible without login Plain text file phpunit.xml.dist Data Auxiliary data
Accessible without login Plain text file psalm.xml Data Auxiliary data
Accessible without login Plain text file README.md Doc. Documentation
Accessible without login Plain text file ruleset.xml Data Auxiliary data

  Files folder image Files  /  .github  
File Role Description
Files folder imageworkflows (1 file)

  Files folder image Files  /  .github  /  workflows  
File Role Description
  Accessible without login Plain text file ci.yml Data Auxiliary data

  Files folder image Files  /  examples  
File Role Description
  Accessible without login HTML file Example.html Doc. Documentation
  Accessible without login Plain text file Example.php Example Example script
  Accessible without login Image file Example.png Icon Icon image

  Files folder image Files  /  src  
File Role Description
Files folder imagePartial (2 files)
Files folder imageSimple (2 files)
Files folder imageTable (7 files)
  Plain text file AbstractSimpleTag.php Class Class source
  Plain text file AbstractTag.php Class Class source

  Files folder image Files  /  src  /  Partial  
File Role Description
  Plain text file TrAwareInterface.php Class Class source
  Plain text file TrAwareTrait.php Class Class source

  Files folder image Files  /  src  /  Simple  
File Role Description
  Plain text file Div.php Class Class source
  Plain text file Span.php Class Class source

  Files folder image Files  /  src  /  Table  
File Role Description
  Plain text file Caption.php Class Class source
  Plain text file Table.php Class Class source
  Plain text file Tbody.php Class Class source
  Plain text file Td.php Class Class source
  Plain text file Tfoot.php Class Class source
  Plain text file Thead.php Class Class source
  Plain text file Tr.php Class Class source

  Files folder image Files  /  tests  
File Role Description
Files folder imageSimple (2 files)
Files folder imageTable (5 files)

  Files folder image Files  /  tests  /  Simple  
File Role Description
  Plain text file DivTest.php Class Class source
  Plain text file SpanTest.php Class Class source

  Files folder image Files  /  tests  /  Table  
File Role Description
  Plain text file CaptionTest.php Class Class source
  Plain text file TableTest.php Class Class source
  Plain text file TbodyTest.php Class Class source
  Plain text file TdTest.php Class Class source
  Plain text file TrTest.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 96%
Total:90
This week:1
All time:9,926
This week:560Up