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

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

phergie/phergie-irc-plugin-react-command
========================================

Phergie plugin for parsing commands issued to the bot

2.0.0(10y ago)28.7k5[1 issues](https://github.com/phergie/phergie-irc-plugin-react-command/issues)20BSD-2-ClausePHP

Since Apr 20Pushed 6y ago3 watchersCompare

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

READMEChangelog (1)Dependencies (3)Versions (4)Used By (20)

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-command
========================================

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

A plugin for [Phergie](http://github.com/phergie/phergie-irc-bot-react/) to parse commands issued to the bot.

A common plugin to use in combination with this one is the [CommandHelp plugin](https://github.com/phergie/phergie-irc-plugin-react-commandhelp/), which provides information about available commands and their usage to users.

[![Build Status](https://camo.githubusercontent.com/09b29c99e79140a6e637b3aa9a900c175e223b030c8ca6e93d5603c134aabfae/68747470733a2f2f7365637572652e7472617669732d63692e6f72672f706865726769652f706865726769652d6972632d706c7567696e2d72656163742d636f6d6d616e642e706e673f6272616e63683d6d6173746572)](http://travis-ci.org/phergie/phergie-irc-plugin-react-command)

Install
-------

[](#install)

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

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

```

See Phergie documentation for more information on installing plugins.

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

[](#configuration)

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

    // Select how you'd like the command to be triggered.
    // Only 1 method supported at a time so make sure to remove unused methods.

    'prefix' => '!', // string denoting the start of a command

    // or

    'pattern' => '/^!/', // PCRE regular expression denoting the presence of a
                         // command

    // or

    'nick' => true, // true to match common ways of addressing the bot by its
                    // connection nick

))
```

### Usage

[](#usage)

This plugin monitors `PRIVMSG` and `NOTICE` events attempting to locate commands. When it finds one, it emits a custom event: `'command.COMMAND'` where `COMMAND` is the matched command. Other plugins can subscribe to these events to be notified when a command is received.

Event parameters include an instance of [`CommandEvent`](https://github.com/phergie/phergie-irc-plugin-react-command/blob/master/src/CommandEvent.php)(a subclass of [`UserEvent`](https://github.com/phergie/phergie-irc-event/blob/master/src/UserEvent.php)) that contains data about the parsed command and any other parameters that accompanied the original event that contained the command (e.g. an object that implements [`EventQueueInterface`](https://github.com/phergie/phergie-irc-bot-react/blob/master/src/EventQueueInterface.php)).

Here's an example of a plugin that handles a 'foo' command:

```
use Phergie\Irc\Plugin\React\Command\CommandEvent;
use Phergie\Irc\Bot\React\EventQueueInterface;
use Phergie\Irc\Bot\React\PluginInterface;

class FooPlugin implements PluginInterface
{
    public function getSubscribedEvents()
    {
        return array('command.foo' => 'handleFooCommand');
    }

    public function handleFooCommand(CommandEvent $event, EventQueueInterface $queue)
    {
        $commandName = $event->getCustomCommand();
        $fooParams = $event->getCustomParams();
        // ...
    }
}
```

In its `getSubscribedEvents()` implementation, this plugin indicates that it will listen for `'command.foo'` events emitted by the Command plugin.

It specifies `handleFooCommand()` as the method for handling those events. Among this method's parameters is `$event`, an instance of the Command plugin's special `CommandEvent` class.

`handleFooCommand()` invokes two methods of `$event`: `getCustomCommand()`, which returns the command that was received (`'foo'` in this case) and is primarily useful when the same method is used to handle multiple commands, and `getCustomParams()`, which returns parameters specified when the command was issued.

Let's say the Command plugin is used with no configuration and receives this IRC event:

`PRIVMSG #channel foo bar "two words" baz`

It will emit the `'command.foo'` event. The `$event` parameter sent to a handler method for that event will return `'foo'` when its `getCustomCommand()`method is called and `array('bar', 'two words', 'baz')` when its `getCustomParams()` method is called.

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

34

—

LowBetter than 77% of packages

Maintenance10

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community29

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 70.6% 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 ~305 days

Total

3

Last Release

3798d ago

Major Versions

1.1.0 → 2.0.02015-12-21

### 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 (24 commits)")[![svpernova09](https://avatars.githubusercontent.com/u/967362?v=4)](https://github.com/svpernova09 "svpernova09 (5 commits)")[![matthewtrask](https://avatars.githubusercontent.com/u/4731244?v=4)](https://github.com/matthewtrask "matthewtrask (1 commits)")[![Renegade334](https://avatars.githubusercontent.com/u/9092381?v=4)](https://github.com/Renegade334 "Renegade334 (1 commits)")[![sitedyno](https://avatars.githubusercontent.com/u/216721?v=4)](https://github.com/sitedyno "sitedyno (1 commits)")[![nfauchelle](https://avatars.githubusercontent.com/u/1188162?v=4)](https://github.com/nfauchelle "nfauchelle (1 commits)")[![jkazimir](https://avatars.githubusercontent.com/u/913745?v=4)](https://github.com/jkazimir "jkazimir (1 commits)")

---

Tags

pluginbotreactirc

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

PHPackages © 2026

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