Writing a plugin
A Pressline plugin is a folder dropped into /plugins/. Two files matter: a plugin.json manifest and an entry script (default plugin.php).
Minimal plugin
/plugins/hello-world/plugin.json:
{
"id": "hello-world",
"name": "Hello World",
"version": "1.0.0",
"author": "You",
"description": "Logs every article save.",
"min_pressline": "2.0",
"entry": "plugin.php"
}
/plugins/hello-world/plugin.php:
<?php
PL_Plugin::register('hello-world')
->onArticleSave(function ($article, $id, $action) {
error_log("Article #$id saved: " . ($article['name'] ?? '?'));
})
->addAdminMenuItem('Hello', './plugins/hello-world/page.php', 'ic:round-waving-hand', 2)
->addDashboardCard(function () {
echo '<section class="dashboard-block"><h2>Hello!</h2></section>';
});
Open Rozšíření in the admin, click Aktivovat, done.
Folder layout
/plugins/<plugin-id>/
plugin.json # manifest (required)
plugin.php # entry point (or whatever 'entry' says)
readme.md # optional
assets/ # optional CSS / JS
migrations/ # optional *.sql, run on activation
templates/ # optional
plugin.json reference
| Field | Required | Notes |
|---|---|---|
id | yes | Unique slug, used as the folder name |
name | no | Display name |
version | no | Semver |
author | no | |
description | no | |
homepage | no | |
min_pressline | no | Minimum core version |
permissions | no | Reserved for future scoped grants |
hooks | no | Declarative hook list (informational) |
entry | no | Entry script, defaults to plugin.php |