PHP Classes

PHP HTML Class Library: Compose HTML documents with tag classes

Recommend this page to a friend!
  Info   Example   Screenshots   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 90 All time: 9,960 This week: 488Up
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

 

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 (1)  
  • Example.png
  Files folder image Files (32)  
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

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 96%
Total:90
This week:0
All time:9,960
This week:488Up