dev-master
9999999-devCache purified content to increase performance
MIT
The Requires
by Linus Kohl
extension yii2 security htmlpurifier basehtmlpurifier
Wallogit.com
2017 © Pedro Peláez
Cache purified content to increase performance
Yii2 component that caches the results of HTML Purifier in a cache that implements the yii\caching\CacheInterface. This will remove malicious code (XSS) from strings and make it standards compliant. More information available at the Yii2 Security best practices, (*1)
Via Composer ``` bash $ composer require linuskohl/yii2_cached_purifier dev-master, (*2)
or add
"linuskohl/yii2_cached_purifier": "dev-master", (*3)
to the require section of your composer.json file.
## Configuration
To use this component, simply add the following code in your application configuration:
```php
return [
//....
'components' => [
'cache' => [
'class' => 'yii\redis\Cache',
'redis' => [
'hostname' => 'localhost',
'port' => 6379,
'database' => 0,
]
],
'cached_purifier' => [
'class' => '\munichresearch\yii2_cached_purifier\CachedPurifier',
'cache' => 'redis', // name of the cache component
'cache_duration' => 0, // Duration to store the secured strings. Set it to 0 to disable expiration */
'key_prefix' => 'secured_strings::', // Prefix for the cache keys
'key_hash' => 'sha512' // Hash used to create key
],
],
];
<?= \Yii::$app->cached_purifier->purify($insecure_string) ?>
The MIT License (MIT). Please see License File for more information., (*4)
Cache purified content to increase performance
MIT
extension yii2 security htmlpurifier basehtmlpurifier