district5/filter

District5 Filter Library

Maintainers

Package info

github.com/district-5/php-filter

pkg:composer/district5/filter

Statistics

Installs: 160

Dependents: 2

Suggesters: 0

Stars: 0

Open Issues: 0

3.0.0 2024-02-25 21:32 UTC

This package is auto-updated.

Last update: 2026-02-26 01:56:42 UTC


README

About

This library provides the skeletons to support filters.

Installation

This library requires no other libraries.

composer require district5/filter

Usage

Filter

All filters that implement the filter interface in this library must implement a filter() function that returns the filtered value, for example a filter to make a string lowercase might look as follows:

use \District5\Filter\FilterInterface;

class MyStringToLowerFilter implements FilterInterface
{
    public function filter($value)
    {
        if (extension_loaded('mbstring')) {
            return mb_strtolower($value);
        }

        return strtolower($value);
    }
}

Issues

Log a bug report!