Liphte
$t->table( a::c1ass('data-table'), $t->tr($t->td('Column 1') ) )
<table class="data-table"><tr><td>Column 1</td></tr></table>
Documentation Download
Lightweight PHP HTML Builder library
 

About

Welcome to Liphte!

Liphte is a lightweight html builder or html generator library which is based on HTML and HTML5 tags.

It's kind of wrapper of html or dom builder based on windwalker-dom and windwalker-html, but inspired by projects rudykocur/pyeve and rudykocur/breve which is simplest way to create or generate html from controllers or views and others php files.

Benefits:

  1. No problem with extending templates for each template-view file.
    Example problem
    (for Laravel Blade)
    @extends('layout.blade.php')
  2. No problem with including templates in templates.
    Example problem
    (for Laravel Blade)
    
                            
    Example problem
    (for Java Server Pages)
    
                        
  3. No need to write special macros for compontens.

  4. No need templates - it is anti-template idea or anti-pattern.

    Code can be written from PHP View Class or View-Controller (Presenter) or PHP Html helper (utils) class.

    Example View
    
                        
  5. It is Object Oriented Design.

    (Polymorphism, Inheritance, Overloading, Overriding)

    Example View
    
                        
  6. More readable code.

    Your HTML is more readable and clean html code.

    Example
    
                        
  7. No more tag closure.

    If you open tag - you open as function and it must have parenthesis. You don't need to remember close tags.

Documentation

Requirerments:

  • Apache server
  • PHP >= 5.6(.9)

Installing Liphte

To start using this library you can add package to your composer.json to require section below record:

Composer required


            

After that, run:

user@mashine /project/dir/path/ $ 'composer update'

Enjoy! Import library and use like in example.

Liphte Quickstart

First of all you need import the main class which is Set of HTML tags.

use liphte\tags\html\Tag;

The next step is create class or method in your favourite class or add below code to your existing method:


            

Syntax

Let's go to learn method syntax and API documentation. Each method in Tag class is magical method, and it means that everything what you write after "->", each method name, it's become HTML tag.

Below methods was defined as @method annotation only. They doesn't exists in class Tag!

Methods


a method - achnor: <a> tag

Main definition:

a( array $htmlAttributes = array (), array|mixed $content = null )

Alternative definition:

a( Attribute ... $attributes, array|mixed $content = null )

Description

Hyperlinks or links method.

Parameters (for main definition)

Type
Name
Description
array
$htmlAttributes
The array of tag attributes.
It must be associative array!
array | mixed | string
$content
String or array of strings which is html tags.
It couldn't be an associative array!

Parameters (for alternative definition)

Type
Name
Description
Attribute ...
$attributes
Unlimited tag attributes separated by ,.
Must be Attribute and object returned by static magic method!
array | mixed | string
$content
String or array of strings which is html tags.
It couldn't be an associative array and must be at least argument!