00f100 / fcphp-sinput
Package to clean input content
Installs: 39
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 1
Open Issues: 0
Type:package
Requires
- php: >=7.2
Requires (Dev)
- 00f100/phpdbug: *
- phpunit/phpunit: 6.*
This package is auto-updated.
Last update: 2024-11-18 05:47:46 UTC
README
Package to clean input content
How to install
Composer:
$ composer require 00f100/fcphp-sinput
or add in composer.json
{ "require": { "00f100/fcphp-sinput": "*" } }
How to use
<?php use FcPhp\SInput\SInput; use FcPhp\SInput\Rules\AddSlashes; use FcPhp\SInput\Rules\HtmlEntities; use FcPhp\SInput\Rules\StripTags; $instance = new SInput(); $instance->addRule('addslashes', new AddSlashes()); $instance->addRule('htmlentities', new HtmlEntities()); $instance->addRule('striptags', new StripTags()); $content = [ 'con"ntent' => 'value"', "ch'~ve" => "value'2", 'tag' => '<tag>content</tag>', ]; $this->instance->executeRules(['striptags', 'htmlentities', 'addslashes'], $content); // Print: // // Array( // 'con"ntent' => 'value"', // 'ch\\\'~ve' => 'value\\\'2', // 'tag' => 'content' // ) // echo $content;