PHPackages                             phergie/phergie-irc-plugin-react-eventfilter - 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. phergie/phergie-irc-plugin-react-eventfilter

AbandonedArchivedLibrary

phergie/phergie-irc-plugin-react-eventfilter
============================================

Phergie plugin for limiting processing of incoming events based on event metadata

2.2.0(7y ago)31.4k4[1 issues](https://github.com/phergie/phergie-irc-plugin-react-eventfilter/issues)1BSD-2-ClausePHP

Since Dec 24Pushed 6y ago3 watchersCompare

[ Source](https://github.com/phergie/phergie-irc-plugin-react-eventfilter)[ Packagist](https://packagist.org/packages/phergie/phergie-irc-plugin-react-eventfilter)[ RSS](/packages/phergie-phergie-irc-plugin-react-eventfilter/feed)WikiDiscussions master Synced 5d ago

READMEChangelog (6)Dependencies (4)Versions (9)Used By (1)

This project is abandoned
=========================

[](#this-project-is-abandoned)

This repo is being kept for posterity and will be archived in a readonly state. If you're interested it can be forked under a new Composer namespace/GitHub organization.

phergie/phergie-irc-plugin-react-eventfilter
============================================

[](#phergiephergie-irc-plugin-react-eventfilter)

[Phergie](http://github.com/phergie/phergie-irc-bot-react/) plugin for limiting processing of incoming events based on event metadata.

Install
-------

[](#install)

The recommended method of installation is [through composer](http://getcomposer.org).

```
composer require phergie/phergie-irc-plugin-react-eventfilter

```

See Phergie documentation for more information on [installing and enabling plugins](https://github.com/phergie/phergie-irc-bot-react/wiki/Usage#plugins).

Configuration
-------------

[](#configuration)

```
new \Phergie\Irc\Plugin\React\EventFilter\Plugin(array(

    // All configuration is required

    // Analogous to 'plugins' setting in bot configuration
    // All elements must implement \Phergie\Irc\Bot\React\PluginInterface
    'plugins' => array(
        // ...
    ),

    // Must reference an object that implements
    // \Phergie\Irc\Plugin\React\EventFilter\FilterInterface
    'filter' => new FooFilter,

))
```

The `'plugins'` setting specifies a list of one or more plugins for which event processing will be limited.

The `'filter'` setting specifies an object that determines which events will be forwarded to the plugins referenced by the `'plugins'` setting.

Usage
-----

[](#usage)

This is an example bot configuration that includes the EventFilter plugin:

```
use Phergie\Irc\Connection;
use Phergie\Irc\Plugin\React\AutoJoin\Plugin as AutoJoinPlugin;
use Phergie\Irc\Plugin\React\EventFilter as Filters;
use Phergie\Irc\Plugin\React\EventFilter\Plugin as EventFilterPlugin;
use Phergie\Irc\Plugin\React\JoinPart\Plugin as JoinPartPlugin;
use Phergie\Irc\Plugin\React\Pong\Plugin as PongPlugin;
use Phergie\Irc\Plugin\React\Quit\Plugin as QuitPlugin;
use Phergie\Irc\Plugin\React\UserMode\Plugin as UserModePlugin;

// These objects are instantiated and assigned to variables here because they
// are referenced multiple times later in the configuration array.
$connection1 = new Connection(array(
    // ...
));
$userModePlugin = new UserModePlugin;

return array(

    'connections' => array(

        $connection1,

        new Connection(array(
            // ...
        ))

    ),

    'plugins' => array(

        // These plugins apply to all connections.
        new PongPlugin,
        $userModePlugin,

        // Because of the applied ConnectionFilter, the bot will automatically
        // join #channel1 only on $connection1.
        new EventFilterPlugin(array(
            'filter' => new Filters\ConnectionFilter(array($connection1)),
            'plugins' => array(
                new AutoJoinPlugin(array('channels' => '#channel1')),
            ),
        )),

        // Because of the applied UserModeFilter, in order to request that the
        // bot join or part a channel, the requesting user must have the op
        // mode in that channel.
        new EventFilterPlugin(array(
            'filter' => new Filters\UserModeFilter($userModePlugin, array('o')),
            'plugins' => array(
                new JoinPartPlugin,
            ),
        )),

        // Because of the applied UserFilter, only the user with the specified
        // user mask will be able to request that the bot terminate its
        // connection to a server.
        new EventFilterPlugin(array(
            'filter' => new Filters\UserFilter(array('nick1!user1@host1')),
            'plugins' => array(
                new QuitPlugin,
            ),
        )),

    ),

);
```

Supported Filters
-----------------

[](#supported-filters)

All filters supported by this plugin are under the `\Phergie\Irc\Plugin\React\EventFilter` namespace.

### Metadata Filters

[](#metadata-filters)

These filters are based on metadata for incoming events.

#### ChannelFilter

[](#channelfilter)

Allows events that are either not channel-specific or originate from one of a specified list of channels.

```
new ChannelFilter(array(

    '#channel1',
    '&channel2',
    // ...

))
```

#### ConnectionFilter

[](#connectionfilter)

Allows events that originate from one of a specified list of connections represented by objects that implement `\Phergie\Irc\ConnectionInterface`.

```
new ConnectionFilter(array(

    new \Phergie\Irc\Connection(array(
        // ...
    )),

    // ...
))
```

#### UserFilter

[](#userfilter)

Allows events that are either not user-specific or originate from one of a specified list of users identified by strings containing [user masks](http://www.ircbeginner.com/opvinfo/masks.html).

```
new UserFilter(array(

    'nick1!username1@host1',
    'nick2!username2@host2',
    // ...

))
```

#### UserModeFilter

[](#usermodefilter)

Allows events that are either not user-specific or originate from users with any of a specified list of modes within the channel in which the events occur. This mode information is obtained using the [UserMode plugin](https://github.com/phergie/phergie-irc-plugin-react-usermode).

```
new UserModeFilter(

    // Pre-configured instance of \Phergie\Irc\Plugin\React\UserMode\Plugin
    $userMode,

    // List of letters corresponding to user modes for which to allow events
    array('o', 'v')

)
```

Common mode values:

- q - owner
- a - admin
- o - op
- h - halfop
- v - voice

### Boolean Filters

[](#boolean-filters)

These filters are applied to other filters to combine or change their results in some way.

#### AndFilter

[](#andfilter)

Allows events that pass all contained filters, equivalent to the boolean "and" operator.

```
new AndFilter(array(
    new ConnectionFilter(array($connection)),
    new ChannelFilter(array('#channel1', '&channel2')),
))
```

This example allows events that occur both within the specified channels and on the specified connection.

#### OrFilter

[](#orfilter)

Allows events that pass any contained filters, equivalent to the boolean "or" operator.

```
new AndFilter(array(
    new UserFilter(array('nick1!user1@host1')),
    new UserModeFilter($userModePlugin, array('o')),
))
```

This example allows events that are initiated by a user either identified by the specified user mask or with the op user mode.

#### NotFilter

[](#notfilter)

Allows events that do not pass the contained filter, equivalent to the boolean "not" operator.

```
new NotFilter(
    new UserFilter(array('nick1!user1@host1'))
)
```

This example allows events that do not originate from the user identified by the specified user mask, effectively functioning as a ban list with respect to functionality of the EventFilter plugin's contained plugins.

Custom Filters
--------------

[](#custom-filters)

Filters are merely classes that implement [`FilterInterface`](https://github.com/phergie/phergie-irc-plugin-react-eventfilter/blob/master/src/FilterInterface.php). This interface has a single method, `filter()`, which accepts an event object that implements [`EventInterface`](https://github.com/phergie/phergie-irc-event/blob/master/src/EventInterface.php)as its only parameter and returns one of the following values:

- `true` if the event should be allowed
- `false` if the event should be denied
- `null` if the event should be ignored by the filter ("pass-through")

Tests
-----

[](#tests)

To run the unit test suite:

```
curl -s https://getcomposer.org/installer | php
php composer.phar install
./vendor/bin/phpunit

```

License
-------

[](#license)

Released under the BSD License. See `LICENSE`.

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance13

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 54.4% 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 ~225 days

Recently: every ~247 days

Total

7

Last Release

2808d ago

Major Versions

1.1.0 → 2.0.02015-12-22

### Community

Maintainers

![](https://www.gravatar.com/avatar/80dec604abed1b21daafc54c430468444a2ad163ad5f8229348b8d241b797778?d=identicon)[elazar](/maintainers/elazar)

---

Top Contributors

[![elazar](https://avatars.githubusercontent.com/u/15487?v=4)](https://github.com/elazar "elazar (37 commits)")[![svpernova09](https://avatars.githubusercontent.com/u/967362?v=4)](https://github.com/svpernova09 "svpernova09 (17 commits)")[![sitedyno](https://avatars.githubusercontent.com/u/216721?v=4)](https://github.com/sitedyno "sitedyno (7 commits)")[![Renegade334](https://avatars.githubusercontent.com/u/9092381?v=4)](https://github.com/Renegade334 "Renegade334 (3 commits)")[![WyriHaximus](https://avatars.githubusercontent.com/u/147145?v=4)](https://github.com/WyriHaximus "WyriHaximus (3 commits)")[![matthewtrask](https://avatars.githubusercontent.com/u/4731244?v=4)](https://github.com/matthewtrask "matthewtrask (1 commits)")

---

Tags

pluginbotreactirc

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/phergie-phergie-irc-plugin-react-eventfilter/health.svg)

```
[![Health](https://phpackages.com/badges/phergie-phergie-irc-plugin-react-eventfilter/health.svg)](https://phpackages.com/packages/phergie-phergie-irc-plugin-react-eventfilter)
```

PHPackages © 2026

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