registerPlugin($this); echo "PluginAPI registered"; } /* Observer-Pattern */ abstract public function update(); } // Some concrete plugin class SuperPlugin extends Core { var $name = 'TestPlugin'; public function update() { echo "called update"; } public function test() { echo "test"; $this->notify(); } } // Application core class Core { private static $instance; /* Constructor */ public function __construct() { self::$instance = $this; $this->plugins[] = array(); } /* Singleton pattern */ public static function getInstance() { if (! self::$instance) { return new Core(); } return self::$instance; } /* Init idiom */ private function init() { } /* Observer-Pattern */ public function registerPlugin(& $pPlugin) { $this->plugins[] =& $pPlugin; } public function notify() { foreach($this->plugins as $observer) { $observer->update(); } } } new Core(); Core::getInstance()->cTest->test();