PHPackages                             diffrentdigital/remove-html-comments - 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. diffrentdigital/remove-html-comments

ActiveLibrary

diffrentdigital/remove-html-comments
====================================

A Statamic addon to remove HTML comments from responses.

1.0.0(1y ago)025MITPHP

Since Jan 10Pushed 1y ago1 watchersCompare

[ Source](https://github.com/delz-dev/RemoveHtmlComments)[ Packagist](https://packagist.org/packages/diffrentdigital/remove-html-comments)[ RSS](/packages/diffrentdigital-remove-html-comments/feed)WikiDiscussions main Synced 1mo ago

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

Remove HTML Comments
====================

[](#remove-html-comments)

[![Total Downloads](https://camo.githubusercontent.com/92bb172a52d33b270e5e708cf554107f17971403566a5c22cb17fe90bfa38bf6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6469666672656e746469676974616c2f72656d6f76652d68746d6c2d636f6d6d656e74732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/diffrentdigital/remove-html-comments)

This Statamic add-on removes HTML comments (`\`) from responses before they are sent to the browser, optimizing your website's output.

---

Features
--------

[](#features)

- Automatically strips all HTML comments from `text/html` responses.
- Lightweight middleware with minimal performance overhead.
- Seamlessly integrates with Statamic.

---

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

[](#installation)

You can install the package via Composer:

```
composer require diffrentdigital/remove-html-comments
```

---

Usage
-----

[](#usage)

Once installed, the add-on is automatically registered in your Statamic application. It runs as middleware for all routes in the `web` middleware group.

### How It Works

[](#how-it-works)

- The middleware processes all HTML responses.
- It identifies HTML comments using a regex pattern and removes them.

No additional configuration is required. 🎉

---

Performance Considerations
--------------------------

[](#performance-considerations)

This add-on is designed to have minimal impact on performance. It only processes responses with the `Content-Type` header set to `text/html`.

### Profiling

[](#profiling)

If you experience any performance concerns, you can use Laravel Debugbar or other profiling tools to measure middleware execution time.

---

License
-------

[](#license)

This package is open-sourced software licensed under the [MIT license](LICENSE).

---

Contributing
------------

[](#contributing)

Contributions, issues, and feature requests are welcome! Feel free to check the [issues page](https://github.com/delz-dev/remove-html-comments/issues).

### To Contribute:

[](#to-contribute)

1. Fork the repository.
2. Make your changes in a feature branch.
3. Submit a pull request.

---

Acknowledgments
---------------

[](#acknowledgments)

This add-on was created by [delz-dev](https://github.com/delz-dev).

---

Functionality
-------------

[](#functionality)

This add-on removes HTML comments from responses, but only when the application is running in the production environment.

Support
-------

[](#support)

If you find this add-on useful, please consider starring the repository on GitHub or sharing it with others. 😊

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance41

Moderate activity, may be stable

Popularity6

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

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

Unknown

Total

1

Last Release

492d ago

### Community

Maintainers

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

---

Tags

addoncommentshtmlstatamicstatamic-v5

### Embed Badge

![Health badge](/badges/diffrentdigital-remove-html-comments/health.svg)

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

###  Alternatives

[statamic/statamic

Statamic

824170.4k](/packages/statamic-statamic)[statamic-rad-pack/runway

Eloquently manage your database models in Statamic.

135192.6k5](/packages/statamic-rad-pack-runway)[statamic/ssg

Generate static sites with Statamic.

254302.4k](/packages/statamic-ssg)[statamic/eloquent-driver

Allows you to store Statamic data in a database.

125598.8k7](/packages/statamic-eloquent-driver)[statamic/seo-pro

65440.7k](/packages/statamic-seo-pro)[rias/statamic-redirect

28298.4k](/packages/rias-statamic-redirect)

PHPackages © 2026

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