Getting Started
Creating a ForkBB extension involves setting up the proper directory structure, defining metadata, and implementing your custom functionality.Create Extension Directory
Create a directory structure under The vendor name should be unique to you or your organization, and the extension name should describe what it does.
ext/ following the pattern vendor-name/extension-name:Create composer.json
Every extension requires a
composer.json file with specific metadata and configuration:The
type field must be set to "forkbb-extension" for ForkBB to recognize it.Define Extension Actions (Optional)
If your extension needs to perform actions during lifecycle events, create an Actions class that extends Then reference it in your
AbstractActions:composer.json:Add Event Listeners
To hook into ForkBB events, define listeners in your Higher priority values run first. See the Events documentation for available events.
composer.json:Add Static Assets (Optional)
If your extension needs CSS, JavaScript, or images, create symlinks to serve them from the When enabled, this creates a symlink at
public/ directory:public/ext/mycompany-hello-world/ pointing to your extension’s public/ directory.Modify Templates (Optional)
Extensions can inject content into templates before they’re rendered:This injects content from
templates/head.forkbb into the HEAD block of specified templates.Add Configuration Values (Optional)
Extensions can add configuration values to the forum:These values are merged into the forum configuration and accessible via
$this->c->config.Extension Validation
When scanning for extensions, ForkBB validates thecomposer.json structure. Required fields include:
name- Must match patternvendor/extension-nametype- Must be"forkbb-extension"description- Brief description of the extensionversion- Semantic version numberauthors- Array of author objects with nameextra.display-name- Human-readable name for admin panel
Example Extension Structure
Here’s a complete example of a well-structured extension:Best Practices
Use namespaced vendor names
Use namespaced vendor names
Choose a unique vendor name to avoid conflicts with other extensions. Use your company name, GitHub username, or domain.
Semantic versioning
Semantic versioning
Follow semantic versioning (MAJOR.MINOR.PATCH) for your extension versions. This helps users understand compatibility.
Handle errors gracefully
Handle errors gracefully
All Actions methods should return
true on success or false on failure. ForkBB will halt the operation on failure.Clean up on uninstall
Clean up on uninstall
Always remove any database tables, files, or configuration in your
uninstall() method to avoid orphaned data.Test all lifecycle methods
Test all lifecycle methods
Test installing, enabling, disabling, updating, and uninstalling your extension to ensure it handles all states correctly.
Next Steps
Event System
Learn how to use events to hook into ForkBB functionality