Reference
Web plugin tutorial
The repository tutorial for a working permission-aware extension.
Includes the complete docs/tutorials/PLUGIN.md reference from this build. Application paths refer to your own installation.
On this page
Build a web plugin#
Start with a clean local VoltexaHub install: run composer install, copy .env.example to .env, configure a disposable local database, run php artisan key:generate, then php artisan forum:install [email protected]. Set FORUM_ADMIN_PASSWORD in the process environment or enter a password at the prompt. Run npm ci && npm run build. Never commit .env, database files or generated accounts.
- Run
php artisan forum:make-plugin hello-board. It createsplugins/hello-board/plugin.json,Plugin.php, and two escaped Blade views. The class namespace includes a stable ID hash so similar IDs cannot collide. The command refuses an existing directory. Do not patch core files. - Run
php artisan forum:plugin install hello-board, thenphp artisan forum:plugin enable hello-board(or use Administration → Plugins). The home page shows the exampleforum.topnotice. Its example route is/extensions/hello-board/example; it and the navigation link are hidden until permission is granted. - In Administration → Permissions, allow
hello-board.viewglobally for the desired group. Sign in as a member of that group, then open the navigation link and route. Verify a guest or ungranted member receives 403. Any additional handler that reads or writes records must check that object's authorization; the declared global ability alone is insufficient. - Add dependencies to
requiresas an ID-to-constraint object, such as{"base-plugin":"^1.2.0"}. Install dependencies first and enable them first. Use stablemajor.minor.patchversions; see the constraint grammar. Add migrations underdatabase/migrations/with globally unique filenames. Declare only plugin-owned tables underowned_tablesusing theplugin_hello_boardprefix. Migrations must be safe to retry after partial DDL failure. - For an updated package, raise its manifest version and run
php artisan forum:plugin upgrade hello-board. Disable enabled dependents first. If migration fails, inspect the database and repair/retry; the installed version remains old and the plugin stays disabled. Never edit a migration already released to users—ship a corrective migration. - Run
php artisan forum:plugin disable hello-boardto remove public hooks/routes/navigation while retaining data. Runphp artisan forum:plugin uninstall hello-boardto remove registration but retain tables and migration history. Reinstall the same or a newer compatible package to reuse that data; keep all published migration files in the package so an eventual purge can identify its exact ledger rows. Only an explicit--purgeuninstall drops declared tables and exact plugin migration records; back up data first.php artisan forum:plugins:disableorFORUM_PLUGINS_ENABLED=falserecovers a public site from a faulty plugin boot without requiring that plugin to run in Administration.
Package only the plugins/hello-board directory. Plugin code is trusted PHP; review it before installation. Unsupported CLI and queued-listener registration are outside the web extension contract.