byrokrat / giroapp

Command line app for managing autogiro donations.
GNU General Public License v3.0
4 stars 2 forks source link

Support true plugins #152

Closed hanneskod closed 6 years ago

hanneskod commented 6 years ago

While working with https://github.com/hanneskod/giroapp-mailer-plugin it became clear we need a better plugin system.

  1. Proposition to create a PluginInterface something like:
interface PluginInterface
{
    public function loadPlugin($settings); // called with a giroapp settings object
    public function getSubscribers(): SubscriberInterface[];
    public function getCommands(): CommandInterface[];
    // ...
}
  1. Then let plugins be a file in /plugins that return a PluginInterface object. Be it a phar archive or a regular php file.. So the loading mechanism should be something like:
$plugin = require 'plugins/my-cool-plugin.phar';
$plugin->loadPlugin($giroappSettings);
// ...
  1. And lastly let the plugin keep settings that should or could be tweeked by the user in the regular settings repository.