PHPackages                             klan1/k1.lib-dom - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. klan1/k1.lib-dom

ActiveLibrary

klan1/k1.lib-dom
================

Say good bye to the inline HTML tags as strings on your PHP code!. DOM Classes from K1.lib.

v0.1.1(6y ago)12681Apache-2.0PHPPHP ^5.6 | ^7.0

Since May 7Pushed 2y ago2 watchersCompare

[ Source](https://github.com/klan1/k1.lib-dom)[ Packagist](https://packagist.org/packages/klan1/k1.lib-dom)[ Docs](https://github.com/klan1/k1.lib-dom)[ RSS](/packages/klan1-k1lib-dom/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (2)DependenciesVersions (3)Used By (1)

k1.lib-dom
==========

[](#k1lib-dom)

Say good bye to the inline HTML tags as strings on your PHP code!

DOM Classes from K1.lib.

Requirements
------------

[](#requirements)

- PHP 5.4 with at least 2MB in memory allowed + Your code requirements. Maybe with 8MB in most cases is enough.
- BOWER and COMPOSER to run tests

Installation
------------

[](#installation)

### In a Composer project:

[](#in-a-composer-project)

```
composer require klan1/k1.lib-dom
```

### No Composer?:

[](#no-composer)

```
git clone https://github.com/klan1/k1.lib-dom.git
```

### To run tests:

[](#to-run-tests)

```
git clone https://github.com/klan1/k1.lib-dom.git
cd k1.lib-dom/test/
bower install
composer install
php -S localhost:8800
```

Then, open in your browser

Basic example
-------------

[](#basic-example)

```
use \k1lib\html\DOM as DOM;

DOM::start('en');

$head = DOM::html()->head();
$body = DOM::html()->body();

$head->set_title("Simple example");

$p = new \k1lib\html\p("Helo world", "class-here", "id-here");

$p->append_to($body);

echo DOM::generate();
```

will generate:

```

		Simple example

		Helo world

```

This one, will give you the same result

```
use \k1lib\html\DOM as DOM;

DOM::start();

DOM::html()->head()->set_title("Simple example");

DOM::html()->body()->append_p("Helo world", "class-here", "id-here");

echo DOM::generate();
```

Foundation Top Bar
------------------

[](#foundation-top-bar)

```
$top_bar = new \k1lib\html\foundation\top_bar(DOM::html()->body()->header());

$top_bar->set_title(1, "APP TITLE");
$top_bar->set_title(2, " :: ");
$top_bar->set_title(3, "HOME");

$li = $top_bar->add_menu_item("#", "Sub menu 1");
$top_bar->add_menu_item("#", "Item 2");
$top_bar->add_menu_item("#", "Item 3");

$sub_menu = $top_bar->add_sub_menu($li);
$top_bar->add_menu_item("#", "Level 1", $sub_menu);
$top_bar->add_menu_item("#", "Level 2", $sub_menu);
$top_bar->add_menu_item("#", "Level 2", $sub_menu);

$top_bar->add_button("#", "Ingresar");
$top_bar->add_button("#", "Salir", "alert");
```

Will generate

```

        APP TITLE
         ::
        HOME

                APP TITLE
                 ::
                HOME

                Sub menu 1

                        Level 1

                        Level 2

                        Level 2

                Item 2

                Item 3

                Ingresar

                Salir

```

Table from Array
----------------

[](#table-from-array)

```
$data = array(
    0 => array(0 => 'Name', 1 => 'Last name', 'Full Name', 'Pic'),
    1 => array('Alejandro', 'Trujillo', "{{field:0}} {{field:1}}", 'https://66.media.tumblr.com/avatar_32dc0cfad91f_128.png'),
    2 => array('Camilo', 'Lopez', "{{field:0}} {{field:1}}", 'https://cdn1.iconfinder.com/data/icons/halloween-6/96/Zombie-128.png'),
);

$img = new \k1lib\html\img();
$img->set_attrib("alt", "Avatar of {{field:0}}");

$table_with_data = new \k1lib\html\foundation\table_from_data('foundation-table', 'table-1');
$table_with_data->set_data($data);
$table_with_data->insert_tag_on_field($img, [3], 'src');
$table_with_data->append_to($body->content());
```

Will generate a pretty table:

```

            Name
            Last name
            Full Name
            Pic

            Alejandro
            Trujillo
            Alejandro Trujillo

            Camilo
            Lopez
            Camilo Lopez

```

LICENSE
-------

[](#license)

Apache License Version 2.0, January 2004.

THANKS
------

[](#thanks)

Thanks to Zend Inc. for the GNU Developer License of Zend Server, it's amazing work on it!

Autor: Alejandro Trujillo J. -

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~441 days

Total

2

Last Release

2484d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3c674d4ed1f2cdf262687201585bf2c40914489754f482f99b8b38cc569461aa?d=identicon)[klan1](/maintainers/klan1)

---

Top Contributors

[![j0hnd03](https://avatars.githubusercontent.com/u/336013?v=4)](https://github.com/j0hnd03 "j0hnd03 (19 commits)")

### Embed Badge

![Health badge](/badges/klan1-k1lib-dom/health.svg)

```
[![Health](https://phpackages.com/badges/klan1-k1lib-dom/health.svg)](https://phpackages.com/packages/klan1-k1lib-dom)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
