PHPackages                             i-lateral/hashtagger - 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. i-lateral/hashtagger

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

i-lateral/hashtagger
====================

Simple library for finding hashtags in string

1.2(9y ago)31931[1 issues](https://github.com/i-lateral/hashtagger/issues)Facebook PlatformPHPPHP &gt;=5.4.0

Since May 11Pushed 9y ago2 watchersCompare

[ Source](https://github.com/i-lateral/hashtagger)[ Packagist](https://packagist.org/packages/i-lateral/hashtagger)[ Docs](https://github.com/i-lateral/hashtagger)[ RSS](/packages/i-lateral-hashtagger/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependencies (1)Versions (7)Used By (0)

HashTagger hashtag parser
=========================

[](#hashtagger-hashtag-parser)

This is a simple class that is designed to extract hashtags from within a string.

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

[](#installation)

The prefered way to run this is via composer:

```
# composer require i-lateral/hashtagger

```

Usage
-----

[](#usage)

First you must instantiate the HashTagger class:

```
use HashTagger\HashTagger

$string = "String with #hashtags";
$tagger = new HashTagger($string);

```

HashTagger will run an initial parsing of the provided string and cache the extracted tags, these can be accessed via:

```
$tagger->get_tags();

```

**NOTE** That each tag will be preceeded with the # symbol, EG:

```
var_dump($tagger->get_tags());

```

Outputs:

```
array(1) {
  [0] =>
  string(8) "#hashtag"
}

```

You can add or remove tags from the final list via the add\_tag and remove\_tag methods:

```
$tagger->remove_tag("#hashtag");
$tagger->add_tag("#newtag");

var_dump($tagger->get_tags());

```

Outputs:

```
array(1) {
  [0] =>
  string(8) "#newtag"
}

```

Wrapping/Converting tags into XML/HTML
--------------------------------------

[](#wrappingconverting-tags-into-xmlhtml)

You can convert tags in the string into HTML elements using the "wrap\_tags" method.

Wrappping all tags in a strong element:

```
    $new_string = $tagger->wrap_tags("strong");

```

You can also add custom attributes to these elements, EG wrapping all tags in a strong element with the class "hashtag":

```
    $new_string = $tagger->wrap_tags(
        "strong",
        array("class" => "hashtag")
    );

```

Finally, you can customise the attributes value to use the tag name (for example to build custom links) by adding the string {tag} to your attribute value, EG:

```
    $new_string = $tagger->wrap_tags(
        "a",
        array("href" => "http://site.com/tag/{tag}")
    );

```

The above will wrap the tag in an anchor element with a custom href specifically for that tag.

Future Development
------------------

[](#future-development)

This lib covers all the basic functionality, but it would be nice to tweak the wrapping method so that it ignores tags that have already been wrapped in an element.

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance13

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity62

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

Total

6

Last Release

3604d ago

Major Versions

0.3 → 1.02016-05-11

### Community

Maintainers

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

---

Top Contributors

[![mlewis-everley](https://avatars.githubusercontent.com/u/687143?v=4)](https://github.com/mlewis-everley "mlewis-everley (12 commits)")

---

Tags

tagginghashtag

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/i-lateral-hashtagger/health.svg)

```
[![Health](https://phpackages.com/badges/i-lateral-hashtagger/health.svg)](https://phpackages.com/packages/i-lateral-hashtagger)
```

###  Alternatives

[fpn/tag-bundle

FPN Tag Bundle

75408.0k2](/packages/fpn-tag-bundle)[jedkirby/tweet-entity-linker

Convert Twitter API Tweet entities such as URLs, Hashtags and User Mentions into their respective HTML entities.

102.7k](/packages/jedkirby-tweet-entity-linker)[kunstmaan/tagging-bundle

Uses FabienPennequin/DoctrineExtensions-Taggable to add tagging to the Kunstmaan bundles

101.4k1](/packages/kunstmaan-tagging-bundle)

PHPackages © 2026

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