2017 © Pedro Peláez
 

library yii2_cached_purifier

Cache purified content to increase performance

image

munichresearch/yii2_cached_purifier

Cache purified content to increase performance

  • Wednesday, March 14, 2018
  • by linuskohl
  • Repository
  • 0 Watchers
  • 0 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

yii2_cached_purifier

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)

Requirements

  • "yiisoft/yii2": ">2.0.0"
  • "ezyang/htmlpurifier": "~4.9.3"
  • "php": ">=5.2"

Install

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        
        ],
    ],
];

Usage

<?= \Yii::$app->cached_purifier->purify($insecure_string) ?>

License

The MIT License (MIT). Please see License File for more information., (*4)

The Versions

14/03 2018

dev-master

9999999-dev

Cache purified content to increase performance

  Sources   Download

MIT

The Requires

 

extension yii2 security htmlpurifier basehtmlpurifier