andy
andy

Reputation: 2399

How to go about allowing plugins for a custom framework?

First off, this isn't really a programming question but more of a programming concept question. Basically, I've built a bespoke PHP framework to speed up deployment on my end and I want some kind of plugin system in place that will allow me to add specific features to the base of the framework (like the SQL class or maybe a Twitter package) that will allow me to throw them into a folder and not have to actually edit the base for every new project.

Any ideas of the best way of going about this?

Upvotes: 3

Views: 251

Answers (2)

user1299518
user1299518

Reputation:

what im doing in my cms:

  • for each plugin i make a folder latin-named of this plugin's name.
  • i create a /translations folder in there too. Check here.
  • have a single php file that has 2 basic functions, the plugin_install and plugin_uninstall (you know, things to happen on install/unistall like tables creation/drop)
  • create a special page of your system that reads these plugins, installed and not and give an on/off switch so users can install/unistall them.
  • load these single files mentioned above by a single call to include_once on top of your index page (or administration page) so to include whatever functionality they offer.
  • enabled plugins will be loaded (include_once) from your main page, and also their functionality, so each plugin can call each other's as well.

Upvotes: 0

Sarfraz
Sarfraz

Reputation: 382646

Here is a nicely written post by @ircmaxell on how to do that and what are the options:

Also check out:

Upvotes: 3

Related Questions