On Mon, 2004-01-05 at 17:13, Justin French wrote: > Hi all, > > I'm struggling to find any tutorials or 'thought starters' on how I can > incorporate script-level plug-ins into a PHP application. > > Another way, can I see some examples of how my application framework > can provide an API for modular, add-on code? > > I understand that there would definitely not be just one solution... in > fact, it may be the case that each solution needs to be tailored to a > specific problem, but I'd like some 'inspiration' to develop my own > code base. > > Any help / ideas / links would be great.
SquirrelMail and PhpWiki can handle plugins. I didn't see anything on the PhpWiki site (I didn't look very hard), but I did find this on the SM site: http://www.squirrelmail.org/wiki/en_US/DevelopingPlugins You also might want to check out mach-ii. It is an application framework that supports plugins. Currently it has only been released for Cold Fusion, but PHP is on the way. There are some docs on the site that might be useful. http://www.machi-ii.com/ Basically, IIRC, there are a number of predefined 'places' in the framework that will call a plugin if that plugin is registered with the framework. Mach-ii is event based so some of the 'places' are before and after an event, for example. Something I have done before, although I am not sure it would be considered a plugin, is to allow some base classes to be extended to provide different behavior. For example, suppose you have a Container class that your framework uses to store data. Maybe your framework has a MysqlContainer and in a config file you tell the framework to use that class when instantiating a Container. $_framework['container_type'] = 'Mysql'; If someone wants to use your framework, but doesn't want to use MySQL, they could write a FileContainer that uses the file system to store data. They just have to extend your Container class and override some of the methods. Then in the config file they would do. $_framework['container_type'] = 'File'; Just some thoughts. I would be curious to know what you come up with. - Brad -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php