The Importance of Interfaces (SOLID)
In the Domain-System, we strictly apply the "Letter I" of SOLID (Interface Segregation Principle). Classes don't depend on each other, they depend on Contracts (Interfaces).
If the system expects you to extract ZIP files, it doesn't depend on the native ZIP library, it asks for an ExtractorInterface. This means tomorrow you can change the extraction method without breaking the entire system.
PluginInterface
Every plugin MUST sign this contract indirectly (by extending the abstract class AbstractPlugin). It dictates the lifecycle rules:
interface PluginInterface
{
public function register(): void;
public function boot(): void;
public function activate(): void;
public function deactivate(): void;
public function uninstall(): void;
}
Explanation of Methods:
- register() / osRegister(): The right place to negotiate capabilities with the Gatekeeper and register Routes, Event Listeners, and Dashboard Menus.
- boot() / osBoot(): Executed after all plugins finish registering.
osBoot(OsRuntimeInterface $runtime)is the architectural standard (v2.7.0) for safe Kernel access. - activate(): Run only once when you turn on the Plugin in the Dashboard (Ideal for Migrations and table creation).
- deactivate() / uninstall(): Used to clean up the traces the plugin left when deactivated or deleted.
ManualModuleInterface (Manual Auto-Discovery v2.7.0)
Any plugin providing a manual/module.php file returning an instance of ManualModuleInterface is automatically discovered by PluginManualScanner and rendered inside the Cockpit's Instruction Manual (/admin/manual):
interface ManualModuleInterface
{
public function getId(): string;
public function getTitle(): string;
public function getSubtitle(): string;
public function getBadge(): string;
public function getAccentColor(): string;
public function getAdminUrl(): ?string;
public function getChecklistItems(): array;
public function renderContent(string $baseUrl = ''): string;
}
This enables plugins (such as Academy LMS, FlexTheme, Pages, and SEO) to ship their own interactive documentation and QA homologation checklists with zero coupling to the Kernel source code!
SchemaDoctorInterface & JsonStoreInterface (Database- and Environment-Agnostic Core)
In Domain-System v2.7.0, the core runtime operates in a database- and platform-agnostic manner:
SchemaDoctorInterface: Injected intoMonitorControllerandStateSnapshotManagerto diagnose and self-heal (healAll()) plugin migrations using pure ANSI SQL.JsonStoreInterface(AtomicJsonStore): Concurrency-safe atomic persistence usingflock(LOCK_EX)+ temporary file + atomicrename()acrossconfig/*.jsonandtemp/*.json.LessonFileScaffolderInterface: Contract powering the Academy LMS Automatic Factory that creates module folders (createFolder) and fabricates physical.phplesson files inside the active theme (e.g.,pages/estrutura-de-dados.php→/cursos/estrutura-de-dados).
🤖 AI Contract Guide
Refer to the Master AI Contract Guide (along with .github/copilot-instructions.md, .cursorrules, and .clinerules) to guide AI assistants in creating extensions compliant with these contracts.