PHP code example of indgy / philter

1. Go to this page and download the library: Download indgy/philter library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

indgy / philter example snippets


use \Indgy\Philter;

$f = new Philter($unsafe_input);
$str = $f->in(['safe','string','options'])
	->default('safe')
	->toString();

use function \Indgy\philter;

$str = philter($unsafe_input)
	->in(['safe','string','options'])
	->default('safe')
	->toString();

philter('Here we go.. ')->apply(function($v) {
	// do your thing here
	$v = $v.=  'I was philtered';
	// always return $v or null
	return $v;
})->toString();