PHPackages                             coercive/xss - 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. coercive/xss

ActiveLibrary[Security](/categories/security)

coercive/xss
============

Coercive Security Router

0.0.9(7mo ago)31.3k1MITPHPPHP &gt;=7.4

Since Oct 15Pushed 7mo ago2 watchersCompare

[ Source](https://github.com/Coercive/Xss)[ Packagist](https://packagist.org/packages/coercive/xss)[ Docs](http://coercive.fr)[ RSS](/packages/coercive-xss/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (6)Dependencies (1)Versions (10)Used By (1)

Coercive Security Xss
=====================

[](#coercive-security-xss)

A simple detection of XSS attack in url. like '&lt;' '&gt;' and quotes...

Get
---

[](#get)

```
composer require coercive/xss

```

Load
----

[](#load)

```
use Coercive\Security\Xss;

# Test URL
$url = "https://mywebsite.com/?var='%22>alert();";

# Load with construct param
$xss = new XssUrl($url);

# Or use setUrl on an alredy loaded instance
$xss = new XssUrl;
$xss->setUrl($url);

# Detect
if($xss->isXss()) { die; }
```

New detection optimisation
--------------------------

[](#new-detection-optimisation)

```
# Test encoded url with script => alert('XSS')
$url = "&#x6A&#x61&#x76&#x61&#x73&#x63&#x72&#x69&#x70&#x74&#x3A&#x61&#x6C&#x65&#x72&#x74&#x28&#x27&#x58&#x53&#x53&#x0027&#x29";

# Load with construct param
$xss = new XssUrl($url);

# Show example
echo 'BEFORE';
echo '';
echo 'AFTER';
```

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance65

Regular maintenance activity

Popularity18

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity59

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

Recently: every ~578 days

Total

9

Last Release

211d ago

PHP version history (2 changes)0.0.1PHP &gt;=7

0.0.9PHP &gt;=7.4

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/20288080?v=4)[Coercive](/maintainers/Coercive)[@Coercive](https://github.com/Coercive)

---

Top Contributors

[![Coercive](https://avatars.githubusercontent.com/u/20288080?v=4)](https://github.com/Coercive "Coercive (10 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/coercive-xss/health.svg)

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

###  Alternatives

[defuse/php-encryption

Secure PHP Encryption Library

3.9k162.4M214](/packages/defuse-php-encryption)[roave/security-advisories

Prevents installation of composer packages with known security vulnerabilities: no API, simply require it

2.9k97.3M6.4k](/packages/roave-security-advisories)[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

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

Realistic password strength estimation PHP library based on Zxcvbn JS

86917.5M63](/packages/bjeavons-zxcvbn-php)[enlightn/security-checker

A PHP dependency vulnerabilities scanner based on the Security Advisories Database.

33732.2M110](/packages/enlightn-security-checker)

PHPackages © 2026

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