PHPackages                             felixdorn/tag - 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. [Templating &amp; Views](/categories/templating)
4. /
5. felixdorn/tag

ActiveLibrary[Templating &amp; Views](/categories/templating)

felixdorn/tag
=============

Generates HTML in a clean and convenient syntax.

2.1.0(3y ago)186MITPHPPHP ^8.1

Since Sep 28Pushed 3y ago2 watchersCompare

[ Source](https://github.com/felixdorn/tag)[ Packagist](https://packagist.org/packages/felixdorn/tag)[ RSS](/packages/felixdorn-tag/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (6)Dependencies (5)Versions (8)Used By (0)

Tag
===

[](#tag)

[![Packagist](https://camo.githubusercontent.com/352b2d19b1f8f3103ef6f2aa4b052945a4fec72ec8e60f7c7adef5f93046824c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f66656c6978646f726e2f746167)](https://camo.githubusercontent.com/352b2d19b1f8f3103ef6f2aa4b052945a4fec72ec8e60f7c7adef5f93046824c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f66656c6978646f726e2f746167)[![Packagist Version](https://camo.githubusercontent.com/97250b0226e11602d42740010d4d171b57e011cf2d51c4a636334a09dc9b6438/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f66656c6978646f726e2f746167)](https://camo.githubusercontent.com/97250b0226e11602d42740010d4d171b57e011cf2d51c4a636334a09dc9b6438/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f66656c6978646f726e2f746167)

Getting started
---------------

[](#getting-started)

You can install the package via composer, if you don't have composer, you can download it [here](https://getcomposer.org/):

```
composer require felixdorn/tag
```

Or by adding a requirement in your composer.json:

```
{
    "require": {
        "felixdorn/tag": "^2.0.0"
    }
}
```

Usage
-----

[](#usage)

```
$tag = tag('div')
    ->class('container')
    ->children(
        tag('h1')->children('Title'),
        'Some raw content'
    );
```

### Adding attributes

[](#adding-attributes)

We use the magic method `__call` to add attributes. You can add any attribute you want.

```
tag('div')
    ->class('alert alert-danger')
    ->children('Something went wrong');
```

To add attributes containing a dash like `aria-hidden`, use the equivalent in camel case (ariaHidden). We'll do the conversion back to kebab case when rendering the tag.

You can also assign multiple attributes at once.

```
tag('div')
    ->attributes([
    'id' => 'my-div',
    'class' => 'mt-2'
]);
```

### Nested tags

[](#nested-tags)

```
tag('div')
    ->class('container')
    ->children(
        tag('h1')->children('Some text')
    );

tag('div')
    ->children([
        tag('h1')->children(
            tag('span')->children('Hello'),
            tag('b')->children('World'),
        ),
        tag('br'),
        tag('h3')->children('Whatever')
    ]);
```

Credits
-------

[](#credits)

- [Félix Dorn](mailto:github@felixdorn.fr)

License
-------

[](#license)

This project is MIT Licensed.

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity71

Established project with proven stability

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

Recently: every ~253 days

Total

7

Last Release

1343d ago

Major Versions

0.1.2 → 1.0.02020-02-24

1.0.1 → 2.0.02021-03-06

PHP version history (3 changes)0.1.2PHP ^7.1

2.0.0PHP ^7.4

2.1.0PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/eeca3822ab1a1281e77e0c4f7bdb671c840417def9884107629952224ce42eb0?d=identicon)[felixdorn](/maintainers/felixdorn)

---

Top Contributors

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

---

Tags

htmlooppackagephp-library

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/felixdorn-tag/health.svg)

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

###  Alternatives

[illuminate/view

The Illuminate View package.

13144.9M1.7k](/packages/illuminate-view)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)[moonshine/moonshine

Laravel administration panel

1.3k217.1k59](/packages/moonshine-moonshine)[ryangjchandler/blade-capture-directive

Create inline partials in your Blade templates with ease.

8222.2M12](/packages/ryangjchandler-blade-capture-directive)[illuminate/console

The Illuminate Console package.

12944.1M5.1k](/packages/illuminate-console)[tallstackui/tallstackui

TallStackUI is a powerful suite of Blade components that elevate your workflow of Livewire applications.

703141.0k7](/packages/tallstackui-tallstackui)

PHPackages © 2026

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