2017 © Pedro PelĆ”ez
 

library htmlable

Simple PHP library for abstraction and rendering of html elements.

image

joaorobertopb/htmlable

Simple PHP library for abstraction and rendering of html elements.

  • Thursday, May 31, 2018
  • by joaorobertopb
  • Repository
  • 1 Watchers
  • 0 Stars
  • 6 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Htmlable

![Build Status][ico-build] Latest Stable Version Total Downloads Latest Unstable Version [Code Coverage][link-scrutinizer] Quality Score Software License, (*1)

Simple PHP library for abstraction and rendering of html elements., (*2)

Install

Via Composer, (*3)

``` bash $ composer require joaorobertopb/htmlable, (*4)


## Usage ``` php $div = new JoaoRobertoPB\Htmlable\Tag('div'); $div->add('Hello, Htmlable!'); $div->render();
  • The html code will be printed by the methodrender().
  • To return the html code use the toHtml() method.

Examples

An empty tag:, (*5)

``` php $div = new Tag('div'); // Or $div = Tag::make('div'); $div->render();, (*6)


``` html <div></div>

A plain tag with text contents:, (*7)

``` php $h1 = new Tag('h1'); $h1->add("Header"); $h1->render();, (*8)


``` html <h1>Header</h1>

A tag with multiple attributes:, (*9)

``` php $a = new Tag('a'); $a->id = "example"; $a->href = "#"; $a->add("Link"); $a->render();, (*10)

//Or attributes via construct method, (*11)

$a = new Tag('a',['id'=>"example", 'href'=>"#"]); $a->add("Link"); $a->render();, (*12)


``` html <a id="example" href="#">Link</a>

A more complex structure:, (*13)

``` php $div = new Tag('div',['class'=>"container"]); $divRow = new Tag('div',['class'=>"row"]); $divCol = new Tag('div',['class'=>"col-md-6"]);, (*14)

$divCol->add("Hello!"); $divRow->add($divCol); $div->add($divRow);, (*15)

$div->render();, (*16)


``` html <div class="container"> <div class="row"> <div class="col-md-6"> Hello! </div> </div> </div>

Change log

Please see CHANGELOG for more information on what has changed recently., (*17)

Testing

bash $ composer test, (*18)

Contributing

Please see CONTRIBUTING for details., (*19)

Credits

This package is inspired by this great book by @pablodalloglio. Here is a package I used as reference., (*20)

License

The MIT License (MIT). Please see License File for more information., (*21)

The Versions

31/05 2018

dev-master

9999999-dev https://github.com/joaorobertopb/htmlable

Simple PHP library for abstraction and rendering of html elements.

  Sources   Download

MIT

The Requires

  • php ^5.6 || >=7.0 <7.3

 

The Development Requires

html joaorobertopb htmlable

31/05 2018

1.1.0

1.1.0.0 https://github.com/joaorobertopb/htmlable

Simple PHP library for abstraction and rendering of html elements.

  Sources   Download

MIT

The Requires

  • php ^5.6 || >=7.0 <7.3

 

The Development Requires

html joaorobertopb htmlable

28/08 2017

1.0.0

1.0.0.0 https://github.com/joaorobertopb/htmlable

Simple PHP library for abstraction and rendering of html elements.

  Sources   Download

MIT

The Requires

  • php ~5.6|~7.0

 

The Development Requires

html joaorobertopb htmlable