PHPackages                             inspiredminds/contao-news-filter-event - 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. inspiredminds/contao-news-filter-event

ActiveContao-bundle[Utility &amp; Helpers](/categories/utility)

inspiredminds/contao-news-filter-event
======================================

Contao extension that provides an event to filter a news list.

1.2.1(4mo ago)15.0k↑130.6%5LGPL-3.0-or-laterPHPPHP &gt;=8.1

Since Mar 27Pushed 4mo ago2 watchersCompare

[ Source](https://github.com/inspiredminds/contao-news-filter-event)[ Packagist](https://packagist.org/packages/inspiredminds/contao-news-filter-event)[ Docs](https://github.com/inspiredminds/contao-news-filter-event)[ GitHub Sponsors](https://github.com/sponsors/fritzmg)[ RSS](/packages/inspiredminds-contao-news-filter-event/feed)WikiDiscussions main Synced 2d ago

READMEChangelog (3)Dependencies (15)Versions (6)Used By (5)

[![](https://camo.githubusercontent.com/6b3bc9a59322cbf3c0ddd59d9dc1b242c2fd0e960a8ff088efcc05cb2ff69b55/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f696e7370697265646d696e64732f636f6e74616f2d6e6577732d66696c7465722d6576656e742e737667)](https://packagist.org/packages/inspiredminds/contao-news-filter-event)[![](https://camo.githubusercontent.com/46887509437f2b1fba54447fabfd601df87d9486792940d9df49e476edaa52a6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f696e7370697265646d696e64732f636f6e74616f2d6e6577732d66696c7465722d6576656e742e737667)](https://packagist.org/packages/inspiredminds/contao-news-filter-event)

Contao News Filter Event
========================

[](#contao-news-filter-event)

Contao provides a way to output custom news items in the news list module via the `newsListFetchItems` hook. However, if two or more extensions want to filter the news items according to some parameters, only one can win. This Contao extension instead provides a `NewsFilterEvent` where you can basically customize the parameters of the `NewsModel::findBy()` call that will fetch the news items from the database. Multiple extensions can add their conditions and thus the news list can be filtered down by multiple parameters provided by these different extensions.

For example, the following event listener would filter the news list via an author query parameter:

```
// src/EventListener/AuthorNewsFilterListener.php
namespace App\EventListener;

use InspiredMinds\ContaoNewsFilterEvent\Event\NewsFilterEvent;
use Symfony\Component\EventDispatcher\Attribute\AsEventListener;
use Symfony\Component\HttpFoundation\RequestStack;

#[AsEventListener]
class AuthorNewsFilterListener
{
    public function __construct(private readonly RequestStack $requestStack)
    {
    }

    public function __invoke(NewsFilterEvent $event): void
    {
        $request = $this->requestStack->getCurrentRequest();
        $authorId = (int) $request->query->get('author');

        if ($authorId addColumn('tl_news.author = ?')
            ->addValue($authorId)
        ;
    }
}
```

Or the following would force sorting all news by their subheadline:

```
// src/EventListener/AuthorNewsFilterListener.php
namespace App\EventListener;

use InspiredMinds\ContaoNewsFilterEvent\Event\NewsFilterEvent;
use Symfony\Component\EventDispatcher\Attribute\AsEventListener;

#[AsEventListener]
class AuthorNewsFilterListener
{
    public function __invoke(NewsFilterEvent $event): void
    {
        $event->addOption('order', 'tl_news.subheadline ASC', true);
    }
}
```

See [here](https://packagist.org/packages/inspiredminds/contao-news-filter-event/dependents?order_by=name) for further examples.

###  Health Score

46

—

FairBetter than 92% of packages

Maintenance77

Regular maintenance activity

Popularity24

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity58

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.

###  Release Activity

Cadence

Every ~267 days

Total

5

Last Release

125d ago

PHP version history (2 changes)1.0.0PHP &gt;=7.4

1.1.1PHP &gt;=8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/25f6ec05570f72d0fcc4d0a4fef2309799d53badf8b30484284e73724661e0d8?d=identicon)[fritzmg](/maintainers/fritzmg)

---

Top Contributors

[![fritzmg](https://avatars.githubusercontent.com/u/4970961?v=4)](https://github.com/fritzmg "fritzmg (14 commits)")

### Embed Badge

![Health badge](/badges/inspiredminds-contao-news-filter-event/health.svg)

```
[![Health](https://phpackages.com/badges/inspiredminds-contao-news-filter-event/health.svg)](https://phpackages.com/packages/inspiredminds-contao-news-filter-event)
```

PHPackages © 2026

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