Skip to content

Repository files navigation

PHP IRC Server

A small, modern IRC server written in PHP 8.5 as a learning and portfolio project. It uses Tempest for the application and dependency-injection layer, and Amp with Revolt for asynchronous networking.

The aim is a focused, single-server implementation that works with normal IRC clients without attempting to reproduce every legacy or server-to-server feature. Live clients and channels are held in memory, with boundaries that leave room for persistence or alternative transports later.

What works

  • IRC message parsing and encoding, including message tags
  • TCP listener, line buffering, message-size validation and connection cleanup
  • Automatic command-handler discovery and dispatch
  • CAP LS and CAP END registration negotiation
  • NICK, including validation, collisions and nickname changes
  • USER and client registration
  • PING responses
  • Registration welcome numerics and 005 feature advertisement
  • Unknown-command and not-registered responses
  • ASCII IRC casemapping for nicknames and channels
  • In-memory channel, membership and channel-registry foundations
  • JOIN, channel broadcasting and names replies
  • Unit and integration test suite

Running the server

Requirements:

  • PHP 8.5
  • Composer

Install dependencies and start the server:

composer install
php tempest irc:serve

By default, it listens on 127.0.0.1:6667. You can connect with an IRC client or test it with netcat:

nc 127.0.0.1 6667

Then register and send a ping:

NICK John
USER john 0 * :John Doe
PING :hello

The defaults can be overridden in .env:

IRC_SERVER_NAME=irc.local
IRC_NETWORK_NAME=PHPIRC
IRC_SERVER_VERSION=phpirc-0.1.0
LISTEN_ADDRESS=127.0.0.1
LISTEN_PORT=6667

Run all quality checks with:

composer qa

Roadmap

  • Client delivery and channel broadcasting
  • Standalone NAMES command
  • Channel cleanup when clients disconnect
  • PART and QUIT
  • PRIVMSG and NOTICE for clients and channels
  • Topics, channel modes and operator commands such as KICK
  • Multiple listeners and TLS
  • Broader IRCv3 capability support
  • Optional persistence where it provides value

Licence

Licensed under the MIT Licence.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages