Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Suggestions for Adding Plugin Capability?

Is there a general procedure for programming extensibility capability into your code?

I am wondering what the general procedure is for adding extension-type capability to a system you are writing so that functionality can be extended through some kind of plugin API rather than having to modify the core code of a system.

Do such things tend to be dependent on the language the system was written in, or is there a general method for allowing for this?

like image 567
kaybenleroll Avatar asked Aug 11 '08 19:08

kaybenleroll


1 Answers

I've used event-based APIs for plugins in the past. You can insert hooks for plugins by dispatching events and providing access to the application state.

For example, if you were writing a blogging application, you might want to raise an event just before a new post is saved to the database, and provide the post HTML to the plugin to alter as needed.

like image 149
palmsey Avatar answered Sep 21 '22 01:09

palmsey