PHPackages                             matejch/html\_helpers - 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. matejch/html\_helpers

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

matejch/html\_helpers
=====================

Helper class for removing elements and content, and extracting file paths

1.0.1(3y ago)07MITPHPPHP &gt;=7.2.0

Since Jun 17Pushed 3y ago1 watchersCompare

[ Source](https://github.com/Matej-ch/HtmlHelpers)[ Packagist](https://packagist.org/packages/matejch/html_helpers)[ RSS](/packages/matejch-html-helpers/feed)WikiDiscussions main Synced 1mo ago

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

[![latest_tag](https://camo.githubusercontent.com/03b4fd582f7ff6f96ff6c1b0348c249ad95659097c90e75593849b578cbc9407/68747470733a2f2f62616467656e2e6e65742f6769746875622f7461672f4d6174656a2d63682f48746d6c48656c70657273)](https://camo.githubusercontent.com/03b4fd582f7ff6f96ff6c1b0348c249ad95659097c90e75593849b578cbc9407/68747470733a2f2f62616467656e2e6e65742f6769746875622f7461672f4d6174656a2d63682f48746d6c48656c70657273)

### Two PHP helper classes for removing html tags and extracting file paths

[](#two-php-helper-classes-for-removing-html-tags-and-extracting-file-paths)

---

Install in your project

```
composer require matejch/html_helpers "^1.0.0"

```

---

### class HtmlTagRemover

[](#class-htmltagremover)

With class `HtmlTagRemover` you can remove specified html tags and its content from html string

*Example: remove tags based on name*

```
$service = new HtmlTagRemover($htmlString);
service->removeTags(['a','img']);
```

---

*Example: remove tags based on content of attribute*

```
$service = new HtmlTagRemover($htmlString);

$service->removeTags(['a' => 'href[files]']);

/** remove 'a' tags where href attribute contains `files` substring and span elements contains class with `test` string */
$service->removeTags(['a' => 'href[files]','span' => 'class[test]']);
```

---

### class HtmlFileExtractor

[](#class-htmlfileextractor)

I created this class, because I needed to extract file paths from html before sending email, and add the as attachment

This class can return source from *img* or *a* tags automatically

But also from custom tags or attributes

*Example: get file paths from **img** and **a** tag*

```
$service = new HtmlFileExtractor($htmlString);

/** return files as array of strings directly from href and src */
$service->getFiles(['img','a'])
```

---

*Example: get file paths other tags or specified attributes*

```
/** return files as array of strings from class attributes of span elements */
$service->getFiles(['span' => 'class'])

$service->getFiles(['span' => 'class','img'=>'alt'])

/** return files as array of strings from class attributes of span elements,
 * where class contains substring 'es' and from alt attribute of image tags
 */
$service->getFiles(['span' => 'class[es]','img'=>'alt'])
```

---

Remove package from your project

```
composer remove matejch/html_helpers
```

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity44

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

Total

2

Last Release

1428d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/932003?v=4)[Matej Leban](/maintainers/MatejCh)[@matejch](https://github.com/matejch)

---

Top Contributors

[![Matej-ch](https://avatars.githubusercontent.com/u/12380989?v=4)](https://github.com/Matej-ch "Matej-ch (12 commits)")

---

Tags

dom-manipulationdomdocumenthtmlhtml-tagsparsingphphtmlfile extractiontag remover

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[spatie/laravel-html

A fluent html builder

8376.4M72](/packages/spatie-laravel-html)[ckeditor/ckeditor

JavaScript WYSIWYG web text editor.

5234.2M76](/packages/ckeditor-ckeditor)[caxy/php-htmldiff

A library for comparing two HTML files/snippets and highlighting the differences using simple HTML.

21520.9M15](/packages/caxy-php-htmldiff)[yajra/laravel-datatables-html

Laravel DataTables HTML builder plugin

2899.6M48](/packages/yajra-laravel-datatables-html)[wa72/htmlpagedom

jQuery-inspired DOM manipulation extension for Symfony's Crawler

3383.9M34](/packages/wa72-htmlpagedom)[tinymce/tinymce

Web based JavaScript HTML WYSIWYG editor control.

1697.5M106](/packages/tinymce-tinymce)

PHPackages © 2026

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