Skip to content

sledgehammer/filters

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sledgehammer Filters

Adds additional filters compatible with the \Sledgehammer\filter() function.

A filter is a callable that takes only 1 argument (as input) and returns the filterd output.

The buildin functions "addslashes" and "urlencode" for example are compatible with sledgehammer's filter "interface".

Examples

$encoded = filter($myData, 'urlencode'); // Using a global function.

$db = new PDO('sqlite::memory:');
$quoted = filter($myData, array($db, 'quote')); // Using a function in a object/class.

$slug = filter($myData, new SlugFilter()); /// Using a object with an __invoke() method.

$filter = function ($data) { return substr($data, 0, 10); };
$truncated = filter($myData, $filter); // Using a closure.

About

Een SledgeHammer module met diverse (tekst)Filters

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages