Welcome Guest, Not a member yet? Register   Sign In
How to Implement a Plugin Framework
#1

[eluser]CodeIgniterNewbie[/eluser]
Can CI be used as a plugin framework somehow? Would like to create modules for my app, drop them in CI somewhere, then my system just "magically" becomes aware of its existence and knows how to use it.
#2

[eluser]dieter[/eluser]
I've been thinking about that as well, and I think the easiest solution is to use an event-handler like Khaos Event...
#3

[eluser]CodeIgniterNewbie[/eluser]
Can you please elaborate?
#4

[eluser]bretticus[/eluser]
It's appropriate that you put "magically" in quotes. Of course, in programming, nothing happens magically.

CodeIgniter is an MVC framework. That's it. There's nothing special about it that lends to a better plugin framework except perhaps that the MVC paradigm itself is a good model for plugin integration.

Keep in mind that CI does have a plugin system built in (albeit somewhat oversimplified and on the verge of being deprecated.)

Most plugin code that I have seen looks for code in a specific folder (plugin perhaps?) and looks for standardized code so we can actually do something with it. For example, in wordpress, you write arrays with specific associative keys that indicate functions to be used in a predefined fashion. See this simple tutorial.



This is a generic answer because, well, there is no specific answer to give. Your plugin system will be tailored to your specific requirements. Accordingly, there may be several approaches. But you must have a "standardized" way (or contract) that must be followed for code to be considered and used as a plugin.

Good luck.
#5

[eluser]WanWizard[/eluser]
We use a similar way to integrate modules in our framework.

Every module has a standardized installer controller that provides information about the module, like which methods it exports, which languages are available, etc. It also takes care of creating database tables specific to the module, upgrade activities when you install an update, and it contains cleanup code in case you uninstall a module.




Theme © iAndrew 2016 - Forum software by © MyBB