PHPackages                             duitni/filter - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. duitni/filter

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

duitni/filter
=============

Filter regular expression and pattern search

19PHP

Since Jul 13Pushed 7y agoCompare

[ Source](https://github.com/nico-duitsmann/Filter)[ Packagist](https://packagist.org/packages/duitni/filter)[ RSS](/packages/duitni-filter/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependenciesVersions (1)Used By (0)

Filter
======

[](#filter)

***NOTE*** This software is still `under developement`!

[![Software License](https://camo.githubusercontent.com/cad8c16a3d580a69d8923c98d8de25d21cb00fa54fa60a856a8e1ca657f79db4/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d47504c76332d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE)

Filter is a php library to find string like patterns or regular expressions in strings, files, directorys and urls.

Install
-------

[](#install)

Via Composer

```
$ composer require duitni/filter dev-master
```

Manually

```
require 'Filter.class.php';

use \Duitni\Filter\Search as Search;
```

Or via remote import

```
eval(base64_decode('Ci8qKgogKiBSYXcgdXJsIGltcG9ydC4KICogQGF1dGhvciBOaWNvIER1aXRzbWFubgogKi8KCmZ1bmN0aW9uIHJhd19pbmNsdWRlKHN0cmluZyAkcmF3VXJsKSB7CiAgICAkdGVtcERpciAgPSBzeXNfZ2V0X3RlbXBfZGlyKCkuIi8ucmF3X2luY2x1ZGUiOwogICAgQG1rZGlyKCR0ZW1wRGlyKTsKICAgICRmaWxlTmFtZSA9ICIkdGVtcERpci8iLnVuaXFpZCgicmF3X2luY2x1ZGUiLCB0cnVlKS4iLnBocCI7CiAgICAkY29udGVudCAgPSBmaWxlX2dldF9jb250ZW50cygkcmF3VXJsKTsKICAgIGZpbGVfcHV0X2NvbnRlbnRzKCRmaWxlTmFtZSwgJGNvbnRlbnQpOwogICAgcmV0dXJuIGluY2x1ZGUgJGZpbGVOYW1lOwp9CgpmdW5jdGlvbiByYXdfaW5jbHVkZV9jbGVhbl9jYWNoZSgpIHsKICAgICRmaWxlcyA9IGdsb2Ioc3lzX2dldF90ZW1wX2RpcigpLiIvLnJhd19pbmNsdWRlLyoiKTsKICAgIGZvcmVhY2goJGZpbGVzIGFzICRmaWxlKSB7CiAgICAgICAgaWYoaXNfZmlsZSgkZmlsZSkpCiAgICAgICAgICAgIHVubGluaygkZmlsZSk7CiAgICB9Cn0K'));
raw_include('https://raw.githubusercontent.com/nico-duitsmann/Filter/master/src/Filter.class.php');

raw_include_clean_cache(); # at file end clearing cache
```

The raw\_include source can be found here:
`https://gist.github.com/nico-duitsmann/f8f301b28389518ff10a5266f12b53cb`

Usage
-----

[](#usage)

```
$options = array(
    'trimResult' => true
);
$search  = new Search($options, 'MyPattern', 'Subject1', 'Subject2', 'Subject3');
$matches = $search->getMatches();
$stats   = $search->getStats();

foreach ($matches as $match) {
    echo 'Found '.$match['pattern'].' on position '.$match['position'].' in '.$match['subject'].'';
}

echo 'Scan finished in : '.$stats[0]['time'];
```

Available options

```
/*
 * patternIsRegex > Search with regex instead of pattern
 * trimResult     > Trim the outputted result
 * maxLineLen     > Define max line length
 * colored        > Colored output
 * hColor         > Define highlight color
*/

// build options array
$options = array(
    'patternIsRegex' => false,
    'trimResult'     => true,
    'maxLineLen'     => 50 ,
    'colored'        => true,
    'hColor'         => 'red',
);
```

***NOTE***: More examples can be find in `examples`.

Author
------

[](#author)

- [Nico Duitsmann](https://github.com/nico-duitsmann)

License
-------

[](#license)

GNU General Public License v3. Please see [License File](LICENSE) for more information.

Disclaimer
----------

[](#disclaimer)

The author takes NO responsibility and/or liability for how you choose to use any of the tools/source code/any files provided. The author and anyone affiliated with will not be liable for any losses and/or damages in connection with use of ANY files provided with Filter. By using Filter or any files included, you understand that you are AGREEING to that.

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity40

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/447c534493f2b9e8072366821f3aed4551b48c49821ed5191f8e0d05ef6c471b?d=identicon)[nico-duitsmann](/maintainers/nico-duitsmann)

---

Top Contributors

[![nico-duitsmann](https://avatars.githubusercontent.com/u/33223888?v=4)](https://github.com/nico-duitsmann "nico-duitsmann (4 commits)")

---

Tags

grepgrep-searchpattern-matchingpattern-searchphp7regex-matchstring-matchingstring-search

### Embed Badge

![Health badge](/badges/duitni-filter/health.svg)

```
[![Health](https://phpackages.com/badges/duitni-filter/health.svg)](https://phpackages.com/packages/duitni-filter)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
