1. Go to this page and download the library: Download blessing/filter 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/ */
blessing / filter example snippets
use Blessing\Filter;
class MyController extends Controller
{
public function home(Filter $filter)
{
//
}
}
$filter->add('hook_name', function ($value) {
return $value;
});
class MyFilter
{
public function filter($value)
{
return $value;
}
}
$filter->add('hook_name', MyFilter::class);
// or
$filter->add('hook_name', 'MyFilter');
$filter->add('hook_name', function ($value) {
return $value;
}, 30); // Higher than default priority.
$filter->add('hook_name', function ($value, $arg1, $arg2) {
if ($arg1 === '...') {
return $value;
}
return $value.'!';
});
$value = $filter->apply('hook_name', 'hi', ['abc', 'def']);
// You should get the text "hi!" here.
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.