devtoolboxuk / soteria
Security Package for PHP
Installs: 5 593
Dependents: 2
Suggesters: 0
Security: 0
Stars: 0
Watchers: 3
Forks: 0
Open Issues: 0
Requires
- php: >=5.4.16
- devtoolboxuk/soteriautf: ~0.0.2
- devtoolboxuk/utilitybundle: ~1.0.11
Requires (Dev)
README
Table of Contents
Background
Various security libraries rolled into one place.
The XSS cleaner is a port from https://github.com/voku/anti-xss with the ability for it to work on some older systems.
When I get around to upgrading my legacy systems, the XSS cleaner will be updated to use voku/anti-xss directly (because it's awesome)
I've also added a URL decoder, as I found some items causing a few issues with invisible characters such as \r\n (in a URL, you probably wouldn't want this)
Usage
$ composer require devtoolboxuk/soteria
Then include Composer's generated vendor/autoload.php to enable autoloading:
require 'vendor/autoload.php';
use devtoolboxuk\soteria; $this->security = new SoteriaService();
XSS
$xss = $this->security->xss();
XSS Clean
Great for clearing out data in posted data
#$data can be either a string or an array $xss->clean($data); //Outputs data that has had XSS data removed.
XSS Detected
$xss->clean($data); $xss->isXssFound(); //Returns true / false
XSS Clean a URL
Great for clearing out crappy URLs (does the same as clean, but also removes invisible characters like \r \n)
#$data can be either a string or an array $xss->cleanUrl($data); //Outputs data that has had XSS data removed.
XSS Detected
$xss->cleanUrl($data); $xss->isXssFound(); //Returns true / false
Filter
$filter = $this->security->filter();
Filter Email
$filter->email('test@local.com');
Filter Was an invalid email address used
$filter->email('test@local.com'); $filter->isValid(); //Returns true / false
Maintainers
License
MIT © DevToolboxUK