Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Zend Filter Laravel Package

zendframework/zend-filter

Filtering and normalization utilities for PHP from Zend Framework. Provides a range of filters to sanitize, convert, and transform input (strings, numbers, arrays, etc.), with extensible interfaces for custom filters—useful for validation pipelines and data processing.

View on GitHub
Deep Wiki
Context7

Static Filter

If it is inconvenient to load a given filter class and create an instance of the filter, you can use StaticFilter with it's method execute() as an alternative invocation style. The first argument of this method is a data input value that you would pass to the filter() method. The second argument is a string, which corresponds to the basename of the filter class, relative to the Zend\Filter namespace. The execute() method automatically loads the class, creates an instance, and applies the filter() method to the data input.

echo StaticFilter::execute('&', 'HtmlEntities');

You can also pass an array of constructor arguments, if they are needed for the filter class:

echo StaticFilter::execute(
    '"',
    'HtmlEntities',
    ['quotestyle' => ENT_QUOTES]
);

The static usage can be convenient for invoking a filter ad hoc, but if you have the need to run a filter for multiple inputs, it's more efficient to create an instance of the filter and invoke it. instance of the filter object and calling its filter() method.

Additionally, filter chains allow you to instantiate and run multiple filters on demand to process sets of input data.

Using custom Filters

You can set and receive the FilterPluginManager for the StaticFilter to amend the standard filter classes:

$pluginManager = StaticFilter::getPluginManager()
    ->setInvokableClass('myNewFilter', 'MyCustom\Filter\MyNewFilter');

StaticFilter::setPluginManager(new MyFilterPluginManager());

This is useful when adding custom filters to be used by the StaticFilter.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport
twbs/bootstrap4
php-http/client-implementation
phpcr/phpcr-implementation
cucumber/gherkin-monorepo
haydenpierce/class-finder
psr/simple-cache-implementation