September comes with a WordPress-style plugin system: you can add pages, settings, menu items and behaviour without touching core or theme files. The package includes a working reference plugin at content/plugins/hello-september/. It shows routes, a controller, views, a migration and hook usage in one place; copy it as a starting point for your own plugin.
Directory structure
content/plugins/my-plugin/
├── plugin.json # Required manifest
├── bootstrap.php # Loaded on every request while active; register hooks here
├── src/ # PSR-4: September\Plugins\MyPlugin\ (slug in StudlyCase)
├── migrations/ # Run on activation; rolled back by uninstall --purge
├── views/ # Plugin views (themes can override them)
├── assets/ # Served from /content/plugins/my-plugin/assets/...
└── lang/ # tr.php, en.php (merged with core strings)
plugin.json
{
"name": "My Plugin",
"version": "1.0.0",
"author": "Me",
"description": "What it does",
"min_core": "0.2.0",
"requires": ["another-plugin"]
}
nameandversionare required. A plugin with an invalid manifest is left out of the list and the problem is written to the log.min_core: activation is refused if the core version is lower.requires: activation is refused unless the listed plugins are active.
Activating and removing
php september plugin:list
php september plugin:activate my-plugin # runs migrations/
php september plugin:deactivate my-plugin # data stays, code is disabled
php september plugin:uninstall my-plugin --purge # rolls back migrations
An error in bootstrap.php does not take the site down: the plugin is deactivated automatically, the error is logged and the plugin.failed action fires.
Using hooks
Plugins connect to the core through hooks. An action runs code when something happens; a filter receives a value and returns a modified version. Lower priority numbers run first (default 10); callbacks with the same priority run in registration order.
use September\Core\Hook\Hook;
Hook::addAction('auth.login', fn ($user) => logger()->info('login', ['id' => $user->getKey()]));
Hook::addFilter('home.rows', fn (array $rows): array => [...$rows, $myRow]);
The full list of available hooks is on the Hook reference page.
Example bootstrap.php
A shortened version of the reference plugin: it adds a route, its own view folder and a footer column.
<?php
declare(strict_types=1);
use September\Core\Hook\Hook;
use September\Plugins\MyPlugin\MyPluginController;
// Register a route
Hook::addAction('routes.register', static function ($router): void {
$router->get('/hello', [MyPluginController::class, 'index'])->name('my-plugin');
});
// Map "my-plugin/..." views to this plugin's views/ folder;
// if the theme provides a file with the same name, the theme wins
Hook::addFilter('view.resolve', static function (string $path, string $name): string {
if (str_starts_with($name, 'my-plugin/')) {
$candidate = __DIR__ . '/views/' . substr($name, strlen('my-plugin/')) . '.php';
if (!is_file($path) && is_file($candidate)) {
return $candidate;
}
}
return $path;
}, 20);
// Add a footer column
Hook::addFilter('footer.columns', static function (array $columns): array {
$columns[] = [
'label' => 'My Plugin',
'links' => [['Hello page', '/hello']],
];
return $columns;
});
Plugin settings
Register setting definitions with the settings.definitions filter, giving them group: plugin and owner: plugin-slug. The admin panel builds the settings form automatically under System → Plugin Settings (/yonetim/eklentiler/{slug}/ayarlar). Read and write values with Setting::get() / Setting::set().
Hook::addFilter('settings.definitions', static function (array $definitions): array {
$definitions['my_plugin.greeting'] = [
'type' => 'string',
'default' => 'Hello!',
'label' => 'Greeting text',
'group' => 'plugin',
'owner' => 'my-plugin',
'section' => 'general',
'hint' => 'Heading of the plugin row on the home page.',
];
return $definitions;
});
| Field | Description |
|---|---|
type | string, bool, int, json |
default | Default value |
label | Form label |
group | core (default), theme, plugin |
owner | Theme or plugin slug (required when group is theme/plugin) |
section | Section name within the form (optional) |
input | text, textarea, code, checkbox, select, json |
hint | Help text shown under the field |
admin | If false, the field is not shown on the general form |
readonly | If true, the field cannot be edited on the form |
rules | Validation rules (separated by |) |
Rules
- Extend through hooks: never modify core or theme files; your changes would be lost on update.
- Security: all queries through models / QueryBuilder (prepared statements), all output through
e(), all write forms withcsrf_field(), all input throughValidator. - Routes are registered in the
routes.registeraction. - Views: map your own namespace with the
view.resolvefilter and use anis_file($path)check so themes can override them. - Table names are prefixed with the plugin slug:
myplugin_records. - Setting keys are prefixed too:
my_plugin.…. - CLI commands, if needed, are registered with the
console.commandsfilter.