Search by

apricot / shoutbox

dodgycoffee

An example apricot extension. Tiny shoutbox that touches all basics

Package info

source.tube/brindly/apricot-extension

Issues

Type:apricot-extension

pkg:composer/apricot/shoutbox

Statistics

Installs: 2

Dependents: 0

Suggesters: 0

0.5.2 2026-10-15 02:18 UTC

This package is auto-updated.

Last update: 2026-10-15 02:49:10 UTC


README

A neat example extension for apricotbb

A tiny shoutbox (apricot/shoutbox) that works as a functional example of how to build an Apricot extension. It touches a bit of everything extensions have access to

I find functional examples a better teacher than endless docs

Try it

From within an apricot install:

composer require apricot/shoutbox
php apricot/apricot db::migrate

composer require automatically runs theme::install which will publish any bundled assets. Same for composer update commands

Where stuff lives

basicfile
package + discoverycomposer.json (type and extra.apricot)
entry pointsrc/Shoutbox.php. this is where its wired up
config defaultsconfig/addons/shoutbox.php. is read with Config::get('addons.shoutbox.maxLength'). sites override in apricot/config/addons/shoutbox.php
migrationsmigrations/. prefixed with shoutbox_ to prevent clashes
default permsmigrations/shoutbox_002_grant_groups.php
routes + handlerssrc/Shouts/ShoutRoutes.php + src/Shouts/ShowShoutbox.php, ShowLatest.php, AddShout.php
templatestemplates/shoutbox/. Themes and local templates can override
gatewaysrc/Shouts/Shouts.php (raw sql) and src/Shouts/Shout.php (row object)
permissionsShoutbox::VIEW and Shoutbox::SHOUT. handlers + twig can()
template slotssrc/Shouts/PlaceShoutbox.php uses the index.end slot
listenerssrc/Shouts/WelcomeMember.php (signups) + src/Shouts/MoveMentions.php (renames)
refuse postssrc/Shouts/HushCaps.php. prevents all caps posts
custom eventsrc/Hooks/Events/ShoutCreatedEvent.php. used by AddShout::add(). other extensions can use hook too
notificationssrc/Shouts/ChirpMentioned.php notifies anyone @mentioned in a shout
markdownsrc/Shouts/Markdown/ adds !!loud!! which also works in normal posts
admin settingssrc/Settings/Megaphone.php + templates/admin/shoutbox/settings.twig
admin pagesrc/Admin/ + templates/admin/shoutbox/index.twig. adds a sidebar link
assetsassets/{css,js,svg}/shoutbox/. queued with boot()
cli + schedulesrc/CLI/PruneShouts.php. the shouts::prune command. runs nightly with queue::work worker
flood controlshout normal throttle rule in register()
shared rulesadd() in src/Shouts/AddShout.php. form and api both call it so the rules live in one spot
json apisrc/Shouts/ServeShouts.php + TakeShout.php + ShapeShout.php. only available when apricot/api is installed. see ShoutRoutes::calls()
dataApi::share('shoutbox', ...) in Shoutbox.php

Things to try

  • shout something from the index
  • mention someone with @name, they get a notification
  • sign up and see a welcome shout (can be turned off)
  • turn on Refuse all caps and try and yell
  • php apricot/apricot shouts::prune for some cleanup
  • install apricot/api and check out /api/v1/shouts