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

Laminas Filter Laravel Package

laminas/laminas-filter

A collection of reusable data filters for PHP apps. Provides string and numeric normalization, file and HTML filters, and a plugin manager to compose filter chains. Useful for sanitizing and transforming input consistently across Laminas and other frameworks.

View on GitHub
Deep Wiki
Context7

Basic Usage

Following is a basic example of using a filter upon two input data, the ampersand (&) and double quote (") characters:

$htmlEntities = new Laminas\Filter\HtmlEntities();

echo $htmlEntities->filter('&'); // &
echo $htmlEntities->filter('"'); // "

Filtering via Invokables

The interface Laminas\Filter\FilterInterface contains also the magic method __invoke(). This allows to use a filter as an invokable:

$strtolower = new Laminas\Filter\StringToLower;

echo $strtolower('I LOVE Laminas!'); // i love laminas!
$laminaslove = $strtolower('I LOVE Laminas!');

Double Filtering

When using two filters in succession, you have to keep in mind that it is often not possible to get the original output by using the opposite filter. Take the following example:

$original = 'my_original_content';

// Attach a filter
$filter   = new Laminas\Filter\Word\UnderscoreToCamelCase();
$filtered = $filter->filter($original);

// Use it's opposite
$filter2  = new Laminas\Filter\Word\CamelCaseToUnderscore();
$filtered = $filter2->filter($filtered)

The above code example could lead to the impression that you will get the original output after the second filter has been applied. But thinking logically this is not the case. After applying the first filter, my_original_content will be changed to MyOriginalContent. But after applying the second filter, the result is My_Original_Content.

As you can see it is not always possible to get the original output by using a filter which seems to be the opposite. It depends on the filter and also on the given input.

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.
codraw/framework-extra-bundle
codraw/messenger
codraw/security
codraw/mailer
codraw/contracts
codraw/profiling
codraw/dependency-injection
codraw/tester
codraw/core
nexmo/api-specification
capell-app/block-library
axium/identity
cetria/laravel-dummy-models
cetria/reflection-helper
agropredict/sso-auth-bundle
evolvestudio/spam-protection
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony