- Plugins nach WordPress-Prinzip: plugin.json-Manifest mit Versions- und Abhängigkeitsprüfung, eigenes PSR-4-Autoloading, register()/boot(), activate()/deactivate()/uninstall(), Migrationen, Routen und Views je Plugin - plugins-core/ (mitgeliefert, aktiv bis zur Deaktivierung) und plugins/ (Kunden-Plugins, geschützt vor Updates, inaktiv bis zur Aktivierung) - Zustand in storage/app/plugins.json – Laden ohne Datenbankabfrage - Wiederherstellungsmodus: Ausnahmen und Fatal Errors beim Laden deaktivieren das Plugin, das Portal bleibt erreichbar - Hooks (Actions/Filter mit Prioritäten) und Registries für Navigation, Startseiten-Kacheln, Rechte und Admin-Seiten (Filament-Discovery) - Admin-Seite „Plugins“: aktivieren, deaktivieren, per ZIP installieren (ZIP-Slip-Schutz), löschen mit oder ohne Daten; abschaltbar per INHAUS_DISALLOW_FILE_MODS - Startseite komplett aus Kacheln; Plugin-Seiten als „slug::Seite“ - Version 0.3.0 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
39 lines
1 KiB
PHP
39 lines
1 KiB
PHP
<?php
|
||
|
||
namespace App\Plugins;
|
||
|
||
use Illuminate\Contracts\Foundation\Application;
|
||
|
||
/**
|
||
* Basisklasse für Plugins – mitgelieferte wie vom Kunden installierte.
|
||
*
|
||
* register(): Dienste binden, Navigation/Kacheln/Rechte registrieren (früh, vor boot).
|
||
* boot(): Hooks, Routen, Views – alles, was andere Dienste braucht.
|
||
* activate()/deactivate()/uninstall(): Lebenszyklus, vom Admin ausgelöst.
|
||
*/
|
||
abstract class Plugin
|
||
{
|
||
public function __construct(
|
||
protected readonly Application $app,
|
||
public readonly PluginManifest $manifest,
|
||
) {}
|
||
|
||
public function register(): void {}
|
||
|
||
public function boot(): void {}
|
||
|
||
public function activate(): void {}
|
||
|
||
public function deactivate(): void {}
|
||
|
||
/**
|
||
* Beim Löschen mit „Daten entfernen“. Die Tabellen aus den Migrationen des
|
||
* Plugins entfernt der Kern selbst.
|
||
*/
|
||
public function uninstall(): void {}
|
||
|
||
protected function path(string $path = ''): string
|
||
{
|
||
return $this->manifest->path.($path !== '' ? '/'.ltrim($path, '/') : '');
|
||
}
|
||
}
|