PHPackages                             bryantebeek/tagger - 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. bryantebeek/tagger

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

bryantebeek/tagger
==================

A beautiful html markup library.

1264PHP

Since Apr 3Pushed 13y agoCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

Installation
============

[](#installation)

Composer
--------

[](#composer)

Installing Tagger with composer is super easy, just add the following requirement to your composer.json:

```
"bryantebeek/tagger": "v1.0.*"

```

Usage
=====

[](#usage)

You can start using Tagger by calling the desired tag name as a static method on the Tag class.

```
Tagger\Tag::div();

Tagger\Tag::img();
```

### Adding content

[](#adding-content)

It is possible to pass the content of a tag right when you initialize it.

```
Tagger\Tag::div('Hello World!');
```

Instead of passing the content in directly, content can be set after the tag has already been initialized.

```
Tagger\Tag::div()->content('Hello World!');
```

The content of a tag can also be set using an anonymous function.

```
Tagger\Tag::div(function ($tag) {
    return 'Hello World!';
});
```

### Adding attributes

[](#adding-attributes)

Attributes can be set in a variety of different ways.

```
//
Tagger\Tag::div()->id('main');

$tag = Tagger\Tag::div();
$tag->id = 'main';
```

Please note that some HTML attributes can't be set using dynamic accessors because they contain, for example, a hyphen.

```
//
Tagger\Tag::div()->setAttribute('data-title', 'Hello World!');
```

It is also possible to set multiple attributes at the same time.

```
$attributes = array(
	'id' => 'main',
	'data-title' => 'Hello World!',
);

Tagger\Tag::div()->setAttributes($attributes);
```

**Please note that all ways of setting attributes return the object to allow for chaining.**

### Rendering a Tag

[](#rendering-a-tag)

There are three possible ways to render a tag to HTML.

```
$tag = Tagger\Tag::div();

// All following lines will output:
echo $tag;
echo $tag->render();
echo $tag->open() . $tag->close();
```

### Checking attributes

[](#checking-attributes)

It is possible to check if a tag has certain attributes.

```
$tag = Tagger\Tag::div()->id('main')->class('container');

$tag->hasAttribute('id'); // true
$tag->hasAttributes(array('id', 'class')); // true
$tag->hasAttributes(array('class', 'title')); // false
```

[![Build Status](https://camo.githubusercontent.com/da7aed0acd39634a54931faeeef3534ee3f79c74baaf8dc278dc188cad05477e/68747470733a2f2f7365637572652e7472617669732d63692e6f72672f627279616e74656265656b2f68746d6c2d7461676765722e706e67)](http://travis-ci.org/bryantebeek/html-tagger)

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity41

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/3377f02748c6c951e0b4c2368df6e71045ea6c5eed946f2291e59c97ee4357df?d=identicon)[bryantebeek](/maintainers/bryantebeek)

---

Top Contributors

[![bryantebeek](https://avatars.githubusercontent.com/u/2136273?v=4)](https://github.com/bryantebeek "bryantebeek (20 commits)")

### Embed Badge

![Health badge](/badges/bryantebeek-tagger/health.svg)

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

###  Alternatives

[jameslkingsley/laravel-references

Drop-in model references.

131.7k](/packages/jameslkingsley-laravel-references)

PHPackages © 2026

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