Carrier Carrier

Carrier is a framework for bulletin board systems in PHP 8.5: one process serves telnet, SSH, rlogin and a browser terminal at the same time, so a caller on SyncTERM can chat with one in Chrome.

composer create-project carrier/app my-board

Needs PHP 8.5 (CLI) with the gmp, mbstring, openssl, pdo_sqlite, sodium and pcntl extensions, and Composer 2.

A tour of the board: matrix, main menu, messages, editor, doors, teleconference, amber theme

One process for telnet, SSH, rlogin and the web

php carrier serve starts all four listeners in one PHP process, including an SSH server written in PHP. Every caller gets a node and a fiber of their own. Who's online, node pages and the teleconference are shared in memory, so callers on different transports see and talk to each other.

Teleconference
The teleconference. Phosphor and Ghost called in over telnet, Sysop in the browser.
Last callers
Last callers records the transport of every call.

PHP code and the screens it draws

Screens from the board kit, next to the code or art that draws them.

app/Menus.php

Each option() is a hotkey and a line in the lightbar. module() runs a feature, goto() opens another menu, and acs('SY') hides the sysop menu from callers who aren't sysops. |NM in a label is replaced with the caller's unread e-mail count.

$menus->define('main', function (MenuDefinition $menu) {
    $menu->title('Main menu')->art('main');
    $menu->option('M', 'Message areas')->goto('messages');
    $menu->option('E', 'E-mail  (|NM new)')->module(Modules\Mail::class);
    $menu->option('C', 'Teleconference')->module(Modules\Teleconference::class);
    $menu->option('D', 'Door games')->goto('doors');
    $menu->option('O', 'Oneliners')->module(Modules\Oneliners::class);
    $menu->option('B', 'Bulletins')->module(Modules\Bulletins::class);
    $menu->option('V', 'Voting booth')->module(Modules\Voting::class);
    $menu->option('W', "Who's online")->module(Modules\WhosOnline::class);
    $menu->option('L', 'Last callers')->module(Modules\LastCallers::class);
    $menu->option('U', 'User list')->module(Modules\UserList::class);
    $menu->option('P', 'Page a node')->module(Modules\PageNode::class);
    $menu->option('Y', 'Page the sysop')
        ->module(Modules\PageNode::class, ['sysop' => true]);
    $menu->option('F', 'Feedback to sysop')->module(Modules\Feedback::class);
    $menu->option('I', 'System info')->module(Modules\SystemInfo::class);
    $menu->option('S', 'Your settings')->module(Modules\Settings::class);
    $menu->option('!', 'Sysop menu')->goto('sysop')->acs('SY');
    $menu->option('G', 'Goodbye')->logoff();
});
Main menu
The main menu. The side panel is filled in from display codes in the menu's art.

app/Modules/WhosOnline.php

A module is a class with a handle() method. Each caller runs in their own fiber, so the code reads top to bottom. $session->nodes holds every node in the process, whatever the transport.

final class WhosOnline extends Module
{
    protected string $activity = "Checking who's online";

    public function handle(Session $session, Terminal $terminal): void
    {
        $this->header($terminal, $session, "Who's online", 'whosonline');
        $terminal->writeln('|08 Node  ' . Fmt::cell('Handle', 20) . Fmt::cell('Location', 18) . Fmt::cell('Doing', 26) . 'Via');
        $terminal->writeln(Fmt::rule(78));

        for ($node = 1; $node <= $session->nodes->maxNodes(); $node++) {
            $other = $session->nodes->node($node);

            if ($other === null) {
                if ($node <= 4) {
                    $terminal->writeln(sprintf(' |08%4d  waiting for a call', $node));
                }

                continue;
            }

            $terminal->writeln(sprintf(
                ' |15%4d  %s%s |03%s |07%s |08%s',
                $node,
                $other === $session ? '|14' : '|11',
                Fmt::cell($other->user?->handle ?? '(logging in)', 19),
                Fmt::cell($other->user?->location ?? '', 17),
                Fmt::cell($other->activity, 25),
                strtoupper($other->connection->protocol()),
            ));
        }

        $terminal->writeln(Fmt::rule(78));
        $terminal->pause();
    }
}
Who's online
Who's online, drawn by the module. The caller's own handle is yellow.

matrix.ans

%VM1 in the art marks the first line of the lightbar. The matrix menu in app/Menus.php supplies the four options. %ND, %MN, %AN and %UP are display codes for the node, the number of nodes, callers online and uptime.

Login matrix
The same art on the board. The lightbar starts at %VM1 and the display codes are filled in.

login.ans

%ET1 and %ET2 mark the handle and password fields. The Login module reads both at those positions, at the width drawn in the art.

Login
The login screen with both fields filled in.

Kits

php carrier install <kit> copies a kit's files into the board's app/ and resources/, where they become the board's own code to edit. composer create-project carrier/app installs board and web. After an upgrade, --force replaces the files with the kit's current version.

  • board

    The BBS. app/Menus.php, the config files, the modules (login, messages, e-mail, teleconference, oneliners, voting, bulletins, settings, sysop tools), models, migrations and the default theme.

    Installed by create-project

    php carrier install board

  • web

    The browser terminal. An xterm.js page with the VGA font, and app/Web/StatusApi.php for the who's online, last callers and oneliners panel beside it.

    Installed by create-project

    php carrier install web

  • games

    Glowcrawl, Viper and Hi-Lo Casino in app/Doors/, and The Oracle in doors/fortune/ with its entry in app/Config/doors.config.php.

    php carrier install games

  • amber

    A second theme in resources/themes/amber/, styled after an amber monochrome monitor. Callers choose it in their settings.

    php carrier install amber

Door games

The games kit adds four doors. Glowcrawl, Viper and Hi-Lo Casino are PHP modules that run inside the board and share high scores between callers. The Oracle is a separate program that the board starts and connects to the caller over stdio.

Door games
The door menu lists the doors the caller's access allows.
Glowcrawl
Glowcrawl, a roguelike. It needs security level 20.
Viper
Viper, a snake game.
Hi-Lo Casino
Hi-Lo Casino. Credits are kept between calls.

Native door

A module with a #[Door] attribute. The board discovers it, lists it in the door menu and enforces its node limit and the caller's time left.

#[Door(
    'viper',
    title: 'Viper',
    description: 'The snake game, at 2400 baud speeds.',
    order: 2,
)]
final class Viper extends DoorGame

External door

An entry in app/Config/doors.config.php. The board writes a DOOR32.SYS drop file and pipes the caller to the program. DOOR.SYS, DORINFOn.DEF and CHAIN.TXT are supported too.

new DoorDefinition(
    name: 'fortune',
    title: 'The Oracle (external door)',
    description: 'A separate program reading DOOR32.SYS over stdio.',
    command: [PHP_BINARY, root_path('doors/fortune/fortune.php'), '{dropFile}'],
    cwd: root_path('doors/fortune'),
    dropFile: 'door32',
    encoding: 'utf8',
    maxNodes: 4,
    order: 90,
),

Try the demo board

A live Carrier board. Call it in the browser here, or with telnet or SSH. Type new as the handle to apply for an account.

Telnet

telnet carrierbbs.com

SSH, as a guest

ssh new@carrierbbs.com

Open the terminal on its own page

Start a board

  1. Create it

    The starter project installs the board and web kits and seeds message areas, a welcome thread, a poll and a few oneliners.

    composer create-project carrier/app my-board
  2. Start it

    One process answers on four ports.

    cd my-board
    php carrier serve
  3. Call in

    Over telnet, SSH or the browser at http://localhost:8080. The first account you apply for becomes the sysop.

    telnet localhost 2323