Popularity
4.5
Growing
Activity
0.0
Stable
498
5
9

Code Quality Rank: L5
Monthly Downloads: 488,160
Programming language: PHP
License: MIT License
Tags: Miscellaneous    
Latest version: v1.1.0

JSONPCallbackValidator alternatives and similar libraries

Based on the "Miscellaneous" category

Do you think we are missing an alternative of JSONPCallbackValidator or a related project?

Add another 'Miscellaneous' Library

README

JsonpCallbackValidator

Build
Status Total
Downloads Latest Stable
Version

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

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

The recommended way to install JsonpCallbackValidator is through Composer:

$ composer require willdurand/jsonp-callback-validator

Unit Tests

Setup the test suite using Composer:

$ composer install

Run it using PHPUnit:

$ ./vendor/bin/phpunit

Contributing

See [CONTRIBUTING](CONTRIBUTING.md) file.

Credits

License

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


*Note that all licence references and agreements mentioned in the JSONPCallbackValidator README section above are relevant to that project's source code only.