New:Introducing Socket Scanning for VS Code Marketplace Extensions.Learn more →
Get Started

adilab/html

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

adilab/html

Adi HTML Tools for PHP

Source
Packagist
Version
v1.0.0
Version published
Total downloads
31
Maintainers
1
Created
Source

Adi HTML Tools for PHP

Adi HTML Tools for PHP is a set of class for prepare HTML code directly in PHP. The set content class for work with basic HTML tags, and to create HTML table code taking data from an array.

Installing

Preferred way to install is with Composer.

Install this library using composer:

$ composer require adilab/html

Usage:

Usage of Tag class. Online demo.

require('vendor/autoload.php');

use Adi\Html\Tag;

$p = new Tag('p', 'Hello world');
$p->addStyle('color: #ff0000')->addStyle('background-color', '#ccc');
echo $p->render();

Usage of complex HTML structure. Online demo.

require('vendor/autoload.php');

use Adi\Html\Div;
use Adi\Html\Strong;

echo Div::create(Strong::create('Hello world'))->setStyle('color: #ff0000');

Usage of Table class. Online demo.

require('vendor/autoload.php');
use Adi\Html\Table\Table;
use Adi\Html\Table\Tr;
use Adi\Html\Table\Td;

$data = array(
    array('aaa', 'bbb', Td::create('ccc')->addClass('ccc')),
    array('ddd', 'eee', 'fff'),
    Tr::create(array('ggg', 'hhh', 'iii'))->addClass('selected'),
);

echo Table::create($data);

Usage of Table class - named columns. Online demo.

require('vendor/autoload.php');
use Adi\Html\Table\Table;
use Adi\Html\Table\Th;
use Adi\Html\Table\Tr;
use Adi\Html\Table\Column;
use Adi\Html\Table\Td;

$data = array(
    array('A' => 'aaa', 'B' => 'bbb', 'C' => 'ccc'),
    array('A' => 'ddd', 'B' => 'eee', 'C' => 'fff'),
    array('A' => 'ggg', 'B' => 'hhh', 'C' => Td::create('iii')->setId('i')),
);

$table = new Table($data);
$table->setColumn('B', Column::create()->addStyle('color', '#ff0000'));
$table->setHeader('B', '[B]');
$table->setHeader('C', Th::create('[C]')->addStyle('color', '#0000ff'));
echo $table;

Documentation

API documentacion

FAQs

Package last updated on 16 Apr 2016

Related posts