ColdBox 3.8.1 - Load Plugins at Startup

I was curious if it was possible for plugins to have a similar event lifecycle as modules, as in… pre/post ModuleLoad & pre/postModuleUnload intercept points, but for plugins?

After testing a few things, it seems plugins don’t get registered until they’re called or injected.

I’m working on a small project where, while I could use Modules, it seems way overkill and too many files when just 1 cfc would do.

That is correct, Plugins are not created until they are needed. If you need a lifecycle, that’s what modules are for. Alternatively, you can just map the Plugin as a model and set it to eagerInit().

Site note: we will be moving away from Plugins entirely in ColdBox 4 in favor of full blown modules, or regular WireBox models:
http://blog.coldbox.org/blog/coldbox-4-roadmap-released

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

Just remember that ColdBox is changing the way plugins work, I am guessing for the reason you just said. But that is in the CB 4.0 road map.

Ah Brad thanks for reminding me, I forgot wirebox has mapDirectory. That will work just fine.

Also, thanks for the heads up about deprecations.

Don,

Modules do not have to be many files. The ModuleConfig.cfc is in itself all you need for a module. So a module can be 1 CFC if you like.

signature0.jpg

Luis F. Majano
CEO
Ortus Solutions, Corp
www.ortussolutions.com

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com

Social: twitter.com/lmajano facebook.com/lmajano