PHPackages                             hoa/irc - 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. hoa/irc

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

hoa/irc
=======

The Hoa\\Irc library.

0.17.01.10(9y ago)264898[7 issues](https://github.com/hoaproject/Irc/issues)[2 PRs](https://github.com/hoaproject/Irc/pulls)BSD-3-ClausePHP

Since Sep 16Pushed 7y ago8 watchersCompare

[ Source](https://github.com/hoaproject/Irc)[ Packagist](https://packagist.org/packages/hoa/irc)[ Docs](https://hoa-project.net/)[ RSS](/packages/hoa-irc/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (10)Dependencies (4)Versions (13)Used By (0)

 [![Hoa](https://camo.githubusercontent.com/2b5c32c5d4bc5e9298821b22d364a522e2dbc0295c1c011b1f9f86a4d07df07e/68747470733a2f2f7374617469632e686f612d70726f6a6563742e6e65742f496d6167652f486f612e737667)](https://camo.githubusercontent.com/2b5c32c5d4bc5e9298821b22d364a522e2dbc0295c1c011b1f9f86a4d07df07e/68747470733a2f2f7374617469632e686f612d70726f6a6563742e6e65742f496d6167652f486f612e737667)

---

 [![Build status](https://camo.githubusercontent.com/86118e34e37d4323f477479d656eef3b9636f04e3fd8835b9c697fd7b7df7265/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f686f6170726f6a6563742f6972632f6d61737465722e737667)](https://travis-ci.org/hoaproject/irc) [![Code coverage](https://camo.githubusercontent.com/a7ac56b3f5726162a3c757d3fd2af95185e2f6cc2c4ad975fced139077239b59/68747470733a2f2f696d672e736869656c64732e696f2f636f766572616c6c732f686f6170726f6a6563742f6972632f6d61737465722e737667)](https://coveralls.io/github/hoaproject/irc?branch=master) [![Packagist](https://camo.githubusercontent.com/7f37358f73e7d6c426f68627497b7a4066f51bb4bff2fda5788edab541bddabb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f686f612f6972632e737667)](https://packagist.org/packages/hoa/irc) [![License](https://camo.githubusercontent.com/57e0d153915a4154e8b107bc6cff7c7e8009b857158c94b1b845933333fdc98d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f686f612f6972632e737667)](https://hoa-project.net/LICENSE)

 Hoa is a **modular**, **extensible** and **structured** set of PHP libraries.
 Moreover, Hoa aims at being a bridge between industrial and research worlds.

Hoa\\Irc
========

[](#hoairc)

[![Help on IRC](https://camo.githubusercontent.com/4dbc9c9d28c30cf1ab591f4bb8212fe4dbddc734145df532a9bb86b09878d4c6/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f68656c702d253233686f6170726f6a6563742d6666303036362e737667)](https://webchat.freenode.net/?channels=#hoaproject)[![Help on Gitter](https://camo.githubusercontent.com/8c4c85951788ff606b1268cb3dd946be05e3054795455d0a7b9250711bc2ac05/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f68656c702d6769747465722d6666303036362e737667)](https://gitter.im/hoaproject/central)[![Documentation](https://camo.githubusercontent.com/7059ad5f1a363f9098686c59d432f01d7330aed9d4b6c8111d985fd64cfc6c60/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f646f63756d656e746174696f6e2d6861636b5f626f6f6b2d6666303036362e737667)](https://central.hoa-project.net/Documentation/Library/Irc)[![Board](https://camo.githubusercontent.com/fd81654ba14b3aca3a713e1b471bc3fc3ba7b5bb3761ccffd6eea2e2ed1fa5ca/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6f7267616e69736174696f6e2d626f6172642d6666303036362e737667)](https://waffle.io/hoaproject/irc)

This library allows to write an IRC client, and interact through listeners and simple methods.

[Learn more](https://central.hoa-project.net/Documentation/Library/Irc).

Installation
------------

[](#installation)

With [Composer](https://getcomposer.org/), to include this library into your dependencies, you need to require [`hoa/irc`](https://packagist.org/packages/hoa/irc):

```
$ composer require hoa/irc '~0.0'
```

For more installation procedures, please read [the Source page](https://hoa-project.net/Source.html).

Testing
-------

[](#testing)

Before running the test suites, the development dependencies must be installed:

```
$ composer install
```

Then, to run all the test suites:

```
$ vendor/bin/hoa test:run
```

For more information, please read the [contributor guide](https://hoa-project.net/Literature/Contributor/Guide.html).

Quick usage
-----------

[](#quick-usage)

We propose a quick overview of a simple client that joins a channel and interacts to mentions. Next, we will enhance this client with a WebSocket server to receive external messages.

### Interact to mentions

[](#interact-to-mentions)

The `Hoa\Irc\Client` proposes the following listeners: `open`, `join`, `message`, `private-message`, `mention`, `other-message`, `ping`, `kick`, `invite` and `error`.

In order to connect to an IRC server, we have to use a socket client, such as:

```
$uri    = 'irc://chat.freenode.net';
$client = new Hoa\Irc\Client(new Hoa\Socket\Client($uri));
```

Then, we attach our listeners. When the connexion will be opened, we will join a channel, for example `#hoaproject` with the `Gordon` username:

```
$client->on('open', function (Hoa\Event\Bucket $bucket) {
    $bucket->getSource()->join('Gordon', '#hoaproject');

    return;
});
```

Next, when someone will mention `Gordon`, we will answer `What?`:

```
$client->on('mention', function (Hoa\Event\Bucket $bucket) {
    $data    = $bucket->getData();
    $message = $data['message']; // do something with that.

    $bucket->getSource()->say(
        $data['from']['nick'] . ': What?'
    );

    return;
});
```

Finally, to run the client:

```
$client->run();
```

### Include a WebSocket server

[](#include-a-websocket-server)

We can add a WebSocket server to receive external messages we will forward to the IRC client. Thus, the beginning of our program will look like:

```
$ircUri = 'irc://chat.freenode.net';
$wsUri  = 'ws://127.0.0.1:8889';

$group  = new Hoa\Socket\Connection\Group();
$client = new Hoa\Irc\Client(new Hoa\Socket\Client($ircUri));
$server = new Hoa\Websocket\Server(new Hoa\Socket\Server($wsUri));

$group[] = $server;
$group[] = $client;
```

Then, we will forward all messages received by the WebSocket server to the IRC client:

```
$server->on('message', function (Hoa\Event\Bucket $bucket) use ($client) {
    $data = $bucket->getData();
    $client->say($data['message']);

    return;
});
```

Finally, to run both the IRC client and WebSocket server:

```
$group->run();
```

To send a message to the WebSocket server, we can use a WebSocket client in CLI:

```
$ echo 'foobar' | hoa websocket:client -s 127.0.0.1:8889
```

Documentation
-------------

[](#documentation)

The [hack book of `Hoa\Irc`](https://central.hoa-project.net/Documentation/Library/Irc)contains detailed information about how to use this library and how it works.

To generate the documentation locally, execute the following commands:

```
$ composer require --dev hoa/devtools
$ vendor/bin/hoa devtools:documentation --open
```

More documentation can be found on the project's website: [hoa-project.net](https://hoa-project.net/).

Getting help
------------

[](#getting-help)

There are mainly two ways to get help:

- On the [`#hoaproject`](https://webchat.freenode.net/?channels=#hoaproject)IRC channel,
- On the forum at [users.hoa-project.net](https://users.hoa-project.net).

Contribution
------------

[](#contribution)

Do you want to contribute? Thanks! A detailed [contributor guide](https://hoa-project.net/Literature/Contributor/Guide.html) explains everything you need to know.

License
-------

[](#license)

Hoa is under the New BSD License (BSD-3-Clause). Please, see [`LICENSE`](https://hoa-project.net/LICENSE) for details.

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance15

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community20

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 84.5% 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 ~76 days

Recently: every ~122 days

Total

12

Last Release

3412d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a410060743cec0e0d8654661b726a7a25f5888f18059d4c942a8fd9a8128f0da?d=identicon)[Hoa](/maintainers/Hoa)

---

Top Contributors

[![Hywan](https://avatars.githubusercontent.com/u/946104?v=4)](https://github.com/Hywan "Hywan (49 commits)")[![shulard](https://avatars.githubusercontent.com/u/482993?v=4)](https://github.com/shulard "shulard (3 commits)")[![vonglasow](https://avatars.githubusercontent.com/u/1275202?v=4)](https://github.com/vonglasow "vonglasow (2 commits)")[![stephpy](https://avatars.githubusercontent.com/u/232744?v=4)](https://github.com/stephpy "stephpy (1 commits)")[![Jir4](https://avatars.githubusercontent.com/u/717155?v=4)](https://github.com/Jir4 "Jir4 (1 commits)")[![hugohenrique](https://avatars.githubusercontent.com/u/4316743?v=4)](https://github.com/hugohenrique "hugohenrique (1 commits)")[![Bhoat](https://avatars.githubusercontent.com/u/4126670?v=4)](https://github.com/Bhoat "Bhoat (1 commits)")

---

Tags

hoairclibraryphpclientlibraryirc

### Embed Badge

![Health badge](/badges/hoa-irc/health.svg)

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

PHPackages © 2026

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