PHPackages                             willdurand/jsonp-callback-validator - 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. willdurand/jsonp-callback-validator

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

willdurand/jsonp-callback-validator
===================================

JSONP callback validator.

v2.0.0(4y ago)65999.9M—5.5%915MITPHPPHP &gt;=7.1.0

Since Oct 21Pushed 2y ago4 watchersCompare

[ Source](https://github.com/willdurand/JsonpCallbackValidator)[ Packagist](https://packagist.org/packages/willdurand/jsonp-callback-validator)[ RSS](/packages/willdurand-jsonp-callback-validator/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (1)Versions (4)Used By (15)

JsonpCallbackValidator
======================

[](#jsonpcallbackvalidator)

[![GitHub Actions](https://github.com/willdurand/JsonpCallbackValidator/workflows/ci/badge.svg)](https://github.com/willdurand/JsonpCallbackValidator/actions?query=workflow%3A%22ci%22+branch%3Amaster)[![Total Downloads](https://camo.githubusercontent.com/506667b0c782867d44ad161d99a2282f4e6c4ac42788e01e6747e2a2319055bb/68747470733a2f2f706f7365722e707567782e6f72672f77696c6c647572616e642f6a736f6e702d63616c6c6261636b2d76616c696461746f722f646f776e6c6f6164732e706e67)](https://packagist.org/packages/willdurand/jsonp-callback-validator)[![Latest Stable Version](https://camo.githubusercontent.com/7c8e009f7cb5a6ed918e5469f9245814b6355df28d470c84aca751714db3dda6/68747470733a2f2f706f7365722e707567782e6f72672f77696c6c647572616e642f6a736f6e702d63616c6c6261636b2d76616c696461746f722f762f737461626c652e706e67)](https://packagist.org/packages/willdurand/jsonp-callback-validator)

**JsonpCallbackValidator** allows you to **validate a JSONP callback** in order to prevent XSS attacks.

Usage
-----

[](#usage)

```
$validator = new \JsonpCallbackValidator();

$validator->validate("JSONP.callback");
// returns `true`

$validator->validate("(function xss(x){evil()})");
// returns `false`
```

Or as a static method:

```
\JsonpCallbackValidator::validate("JSONP.callback");
// returns `true`

\JsonpCallbackValidator::validate("(function xss(x){evil()})");
// returns `false`
```

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

[](#installation)

The recommended way to install JsonpCallbackValidator is through [Composer](https://getcomposer.org/):

```
$ composer require willdurand/jsonp-callback-validator
```

Unit Tests
----------

[](#unit-tests)

Setup the test suite using Composer:

```
$ composer install

```

Run it using PHPUnit:

```
$ ./vendor/bin/simple-phpunit

```

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

[](#contributing)

See [CONTRIBUTING](CONTRIBUTING.md) file.

Credits
-------

[](#credits)

- Erik Eng ([@ptz0n](https://github.com/ptz0n)) for [his Gist](https://gist.github.com/ptz0n/1217080)

License
-------

[](#license)

JsonpCallbackValidator is released under the MIT License. See the bundled LICENSE file for details.

###  Health Score

49

—

FairBetter than 95% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity71

Solid adoption and visibility

Community28

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 76.9% 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 ~1511 days

Total

3

Last Release

1569d ago

Major Versions

v1.1.0 → v2.0.02022-01-30

PHP version history (2 changes)v1.0.0PHP &gt;=5.3.0

v2.0.0PHP &gt;=7.1.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1620075?v=4)[François Ganachaud](/maintainers/couac)[@couac](https://github.com/couac)

---

Top Contributors

[![willdurand](https://avatars.githubusercontent.com/u/217628?v=4)](https://github.com/willdurand "willdurand (20 commits)")[![pborreli](https://avatars.githubusercontent.com/u/77759?v=4)](https://github.com/pborreli "pborreli (2 commits)")[![abienvenu](https://avatars.githubusercontent.com/u/4340135?v=4)](https://github.com/abienvenu "abienvenu (1 commits)")[![GromNaN](https://avatars.githubusercontent.com/u/400034?v=4)](https://github.com/GromNaN "GromNaN (1 commits)")[![Nyholm](https://avatars.githubusercontent.com/u/1275206?v=4)](https://github.com/Nyholm "Nyholm (1 commits)")[![stof](https://avatars.githubusercontent.com/u/439401?v=4)](https://github.com/stof "stof (1 commits)")

---

Tags

jsonpjsonp-callbackphpvalidator

### Embed Badge

![Health badge](/badges/willdurand-jsonp-callback-validator/health.svg)

```
[![Health](https://phpackages.com/badges/willdurand-jsonp-callback-validator/health.svg)](https://phpackages.com/packages/willdurand-jsonp-callback-validator)
```

###  Alternatives

[jasonpriem/human-name-parser

Takes human names of arbitrary complexity and various wacky formats and parses them out.

110119.6k](/packages/jasonpriem-human-name-parser)[scotthuangzl/yii2-google-chart

A wraper for google chart

12189.0k2](/packages/scotthuangzl-yii2-google-chart)

PHPackages © 2026

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