mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-04-02 14:24:27 -04:00
- Consolidate duplicate documentation sections - Move Internationalization section after Plugin Views - Remove redundant Example Plugin Structure and View Hooks sections - Fix PSR-12 brace style in plugin_helper.php - Fix PSR-12 brace style in PluginInterface.php (remove unnecessary PHPdocs) - Fix PSR-12 brace style in BasePlugin.php (remove unnecessary PHPdocs) - Use log_message() instead of error_log() in migration - Add IF NOT EXISTS to plugin_config table creation for resilience - Convert snake_case to camelCase for class names throughout docs
56 lines
1.4 KiB
PHP
56 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Libraries\Plugins;
|
|
|
|
interface PluginInterface
|
|
{
|
|
public function getPluginId(): string;
|
|
|
|
public function getPluginName(): string;
|
|
|
|
public function getPluginDescription(): string;
|
|
|
|
public function getVersion(): string;
|
|
|
|
/**
|
|
* Register event listeners for this plugin.
|
|
*
|
|
* Use Events::on() to register callbacks for OSPOS events.
|
|
* This method is called when the plugin is loaded and enabled.
|
|
*
|
|
* Example:
|
|
* Events::on('item_sale', [$this, 'onItemSale']);
|
|
* Events::on('item_change', [$this, 'onItemChange']);
|
|
*/
|
|
public function registerEvents(): void;
|
|
|
|
/**
|
|
* Install the plugin.
|
|
*
|
|
* Called when the plugin is first enabled. Use this to create database tables,
|
|
* set default configuration values, and run any setup required.
|
|
*/
|
|
public function install(): bool;
|
|
|
|
/**
|
|
* Uninstall the plugin.
|
|
*
|
|
* Called when the plugin is being removed. Use this to remove database tables,
|
|
* clean up configuration, etc.
|
|
*/
|
|
public function uninstall(): bool;
|
|
|
|
public function isEnabled(): bool;
|
|
|
|
/**
|
|
* Get the path to the plugin's configuration view file.
|
|
* Returns null if the plugin has no configuration UI.
|
|
*
|
|
* Example: 'Plugins/mailchimp/config'
|
|
*/
|
|
public function getConfigView(): ?string;
|
|
|
|
public function getSettings(): array;
|
|
|
|
public function saveSettings(array $settings): bool;
|
|
} |