Purpose
The bootstrap file for WordPress plugins can be done in many different ways. I recently changed the PHP file but am always on the lookout for a better way.
Considerations
Proper Hook
No God Class (Uh oh.)
No hooks in constructors
Use Namespaces
Don't mix types (Interfaces, Classes)
Consider the registry pattern
Think about Dependency Injections (DI)
Notes
Asked on wordpress.stackexchange in 2012, there is an updated answer with valuable information.
http://wordpress.stackexchange.com/questions/70055/best-way-to-initiate-a-class-in-a-wp-plugin
Best quote:
The bootstrap file for WordPress plugins can be done in many different ways. I recently changed the PHP file but am always on the lookout for a better way.
Considerations
Proper Hook
No God Class (Uh oh.)
No hooks in constructors
Use Namespaces
Don't mix types (Interfaces, Classes)
Consider the registry pattern
Think about Dependency Injections (DI)
Notes
Asked on wordpress.stackexchange in 2012, there is an updated answer with valuable information.
http://wordpress.stackexchange.com/questions/70055/best-way-to-initiate-a-class-in-a-wp-plugin
Best quote: