PHPackages                             studiow/html - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. studiow/html

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

studiow/html
============

A helper package for generating HTML5 tags

v1.0.1(10y ago)39291MITPHPPHP &gt;=5.4.0

Since Jul 21Pushed 10y agoCompare

[ Source](https://github.com/studiowbe/html)[ Packagist](https://packagist.org/packages/studiow/html)[ RSS](/packages/studiow-html/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (1)Versions (3)Used By (1)

html
====

[](#html)

A helper package for generating HTML5 tags

Usage
-----

[](#usage)

### Installation

[](#installation)

The easiest way to install this package is using composer:

```
composer require studiow/html
```

### Basic usage

[](#basic-usage)

Generating HTML tags with this package is pretty easy:

```
// Create the element
$link = new \Studiow\HTML\Element("a", "Documents", ["href"=>"/documents"]);

// Output
echo (string) $link;
// prints Documents
```

### Getting and setting attributes

[](#getting-and-setting-attributes)

Working with attributes is easy too:

```
// Create the element
$link = new \Studiow\HTML\Element("a", "Documents", ["href"=>"/documents"]);

// Set an attribute
$link->setAttribute('title', 'Go to documents');

// Get the value for an attribute
$link->getAttribute('title');  // returns  'Go to documents'
$link->getAttribute('attr_not_set');  // returns  null

// Remove an attribute
$link->removeAttribute('title');
```

### A touch of class

[](#a-touch-of-class)

Working with classes works pretty much as you'd expect:

```
// Create the element
$link = new \Studiow\HTML\Element("a", "Documents", ["href"=>"/documents"]);

// Add a single class
$link->addClass("button");

// Add multiple classes seperated by a space
$link->addClass("button button-documents");

// Remove a class
$link->removeClass("button");

// Check if the element has a certain class
$link->hasClass("button-documents");
```

### Method chaining

[](#method-chaining)

You can go ahead and chain the methods together

```
$link = new Studiow\HTML\Element("a");
$link->setInnerHTML("Documents")
        ->setAttribute("href", "/documents")
        ->addClass("button")
        ->addClass("button-documents")
        ->setAttribute('title', "Go to documents");
echo (string) $link; // Outputs Documents
```

Known Issues
------------

[](#known-issues)

### Case (in)sensitve

[](#case-insensitve)

HTML5 attributes are supposed to be case-insensitive, but here they are case-sensitive. Lowercase recommended!

### Where is getChildren() etc.?

[](#where-is-getchildren-etc)

This package is by no means meant as a tool to generate large pieces of HTML. While you can use an Element as the innerHTML of another Element it will be converted to text when you do this.

If you find yourself rendering large pieces of HTML within a PHP script, you'd probably be better of using a template system.

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity59

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 ~100 days

Total

2

Last Release

3854d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0b57a4311f92e06e73f6c646344a069d0088747f22e420a583f91bd3e6ab1729?d=identicon)[studiowbe](/maintainers/studiowbe)

---

Top Contributors

[![willemwollebrants](https://avatars.githubusercontent.com/u/916958?v=4)](https://github.com/willemwollebrants "willemwollebrants (11 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/studiow-html/health.svg)

```
[![Health](https://phpackages.com/badges/studiow-html/health.svg)](https://phpackages.com/packages/studiow-html)
```

###  Alternatives

[bassjobsen/bootstrap-3-typeahead

Bootstrap 3 Typeahead

1.7k272.5k4](/packages/bassjobsen-bootstrap-3-typeahead)[cornford/googlmapper

An easy way to integrate Google Maps with Laravel.

457447.9k4](/packages/cornford-googlmapper)[garoevans/php-enum

Convenient way to always have an Enum object available and utilise Spl Types if available.

19158.8k5](/packages/garoevans-php-enum)[rabbit-converter/rabbit-php

Another Zawgyi &lt;=&gt; Unicode Converter

2913.6k](/packages/rabbit-converter-rabbit-php)

PHPackages © 2026

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