PHPackages                             phower/escaper - 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. [Security](/categories/security)
4. /
5. phower/escaper

ActiveLibrary[Security](/categories/security)

phower/escaper
==============

A PHP class which offers a way to escape output and defend from XSS and related vulnerabilities by introducing HTML, CSS and Javascript escaping context.

0.2.3(10y ago)2861MITPHPPHP ^5.4

Since Jul 23Pushed 10y ago2 watchersCompare

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

READMEChangelogDependencies (1)Versions (6)Used By (1)

Phower Escaper
==============

[](#phower-escaper)

A PHP class which offers a way to escape output and defend from XSS and related vulnerabilities by introducing HTML, CSS and Javascript escaping context.

**Phower\\Escaper** is inspired in [Zend's escaper component](https://github.com/zendframework/zend-escaper)and both attempt to minimize the risks from the second most important [OWASP web security risk](https://www.owasp.org/index.php/Top_10_2010-Main).

Instalation
-----------

[](#instalation)

This package uses [Composer](https://getcomposer.org/) tool for auto-loading and dependency management. From your project root folder just run:

```
composer require phower/escaper

```

Usage
-----

[](#usage)

Simply instantiate your object as usual:

```
``` php
use Phower\Escaper;

$escaper = new Escaper();
```

```

Class constructor supports a argument which allows to specify a given encoding format. E.g you can escape code from `iso-8859-1` using:

```
``` php
use Phower\Escaper;

$escaper = new Escaper('iso-8859-1');
```

```

This package is meant to be used for code output escaping only. Looking the implemented interface there are five methods available for that:

- **escapeHtml**: escape a string for the HTML Body context.
- **escapeHtmlAttr**: escape a string for the HTML Attribute context.
- **escapeJs**: escape a string for the Javascript context.
- **escapeCss**: escape a string for the CSS context.
- **escapeUrl**: escape a string for the URI or Parameter contexts.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

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

5

Last Release

3952d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/04e91a806958f09ca8b3f4c24c6f5c4bcbce3c4e44dd882fa1e4c737ee7774c6?d=identicon)[pedrobrazao](/maintainers/pedrobrazao)

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/phower-escaper/health.svg)

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

###  Alternatives

[defuse/php-encryption

Secure PHP Encryption Library

3.9k162.4M214](/packages/defuse-php-encryption)[mews/purifier

Laravel 5/6/7/8/9/10 HtmlPurifier Package

2.0k16.7M113](/packages/mews-purifier)[robrichards/xmlseclibs

A PHP library for XML Security

41478.1M118](/packages/robrichards-xmlseclibs)[bjeavons/zxcvbn-php

Realistic password strength estimation PHP library based on Zxcvbn JS

87117.5M63](/packages/bjeavons-zxcvbn-php)[illuminate/encryption

The Illuminate Encryption package.

9229.7M280](/packages/illuminate-encryption)[paragonie/hidden-string

Encapsulate strings in an object to hide them from stack traces

7410.6M39](/packages/paragonie-hidden-string)

PHPackages © 2026

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