PHPackages                             manuwhat/strip-tags - 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. manuwhat/strip-tags

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

manuwhat/strip-tags
===================

remove PHP and HTML Tags from a string in a custom and efficient way

7117

Since Jun 24Compare

[ Source](https://github.com/manuwhat/strip-tags)[ Packagist](https://packagist.org/packages/manuwhat/strip-tags)[ RSS](/packages/manuwhat-strip-tags/feed)WikiDiscussions Synced 3d ago

READMEChangelogDependenciesVersions (2)Used By (0)

Strip-tags
==========

[](#strip-tags)

remove PHP and HTML Tags from a string in a custom and efficient way

[![Build Status](https://camo.githubusercontent.com/b54f7adf12ede0ec00d5bc47f8a2425e05654314b6137be9ccd97e46904051c1/68747470733a2f2f7472617669732d63692e6f72672f6d616e75776861742f73747269702d746167732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/manuwhat/strip-tags)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/bc1550e987ece255dcfc46f6faad49e7696b3c359d6eeede901f04a7969114bb/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6d616e75776861742f73747269702d746167732f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/manuwhat/strip-tags/?branch=master)[![Build Status](https://camo.githubusercontent.com/eeb91864862cba33ca4cc4d619d53cae3aa348221b992784838d0766ebcb5364/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6d616e75776861742f73747269702d746167732f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/manuwhat/strip-tags/build-status/master)[![Code Intelligence Status](https://camo.githubusercontent.com/37a32007e0de1a3d59c337c37674db6877a17201c8270876555bba94c0e19d53/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6d616e75776861742f73747269702d746167732f6261646765732f636f64652d696e74656c6c6967656e63652e7376673f623d6d6173746572)](https://scrutinizer-ci.com/code-intelligence)

**Requires**: PHP 7.0+
======================

[](#requires-php-70)

### Why strip-tags package if PHP have the strip\_tags function ?

[](#why-strip-tags-package-if-php-have-the-strip_tags-function-)

you could use it if you :

1. want to remove tags with some attributes only
2. want to remove some attributes from some tags
3. want to strip only HTML not PHP or only PHP not HTML
4. want to remove completely some tags and from other tags partially remove some of their attributes
5. want to specify tags to remove instead of tags to keep or tags to keep instead of tags to remove.

### How to use it

[](#how-to-use-it)

Require the library by issuing this command:

```
composer require manuwhat/strip-tags
```

then you can use it this way:

```
$data=$data=''.$x.$y.'  ua';
//$data can be a source string or a file
$hstrip=new htmlstrip($data,'remove',array(Htmlstrip::getTags(),true));//strip every thing PHP and HTML TAGS
$hstrip=new htmlstrip($data,'remove',array(',',true));//remove PHP and sript tags
$hstrip=new htmlstrip($data,'replace',array(',',true),array('onemouseover','true'));//remove PHP and sript tags and onemouseover attributes
//tags and attributes can be specified as array instead of string
var_export(htmlspecialchars($hstrip->go()));//execute
//finally you can refine your choices...
var_export(htmlspecialchars($hstrip->go(htmlstrip::TAGS)));//act only on tags
var_export(htmlspecialchars($hstrip->go(htmlstrip::ATTRIBUTES)));//act only on attributes
var_export(htmlspecialchars($hstrip->go(htmlstrip::TAGS_AND_ATTRIBUTES)));//act on tags and  attributes this is the default behavior
var_export(htmlspecialchars($hstrip->go(htmlstrip::TAGS_WITH_ATTRIBUTES)));//act on tags with some attributes
```

To run unit tests

```
composer test
```

###  Health Score

22

—

LowBetter than 21% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity39

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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/29569475?v=4)[Akpé Aurelle Emmanuel Moïse Zinsou](/maintainers/manuwhat)[@manuwhat](https://github.com/manuwhat)

### Embed Badge

![Health badge](/badges/manuwhat-strip-tags/health.svg)

```
[![Health](https://phpackages.com/badges/manuwhat-strip-tags/health.svg)](https://phpackages.com/packages/manuwhat-strip-tags)
```

###  Alternatives

[olegkoval/php-user-info

Get information about user which visited page of your website

291.8k](/packages/olegkoval-php-user-info)

PHPackages © 2026

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