Bonfire ships with several controllers for you to extend when making your application. Which one you use depends completely on where you are using it and what you need to accomplish. Let’s take a quick look at the different controllers and their suggested uses.
| Base Controllers | Bonfire ships with several controllers for you to extend when making your application. |
| Base_Controller | All of the custom controllers extend from the Base_Controller. |
| Front_Controller | The Front_Controller is intended to be used as the base for any public-facing controllers. |
| Authenticated_Controller | This controller forms the base for the Admin Controller. |
| Admin_Controller | The final controller sets things up even more for use within the Admin area of your site. |
| Conclusion | With all of this being loaded, won’t it affect performance? |
All of the custom controllers extend from the Base_Controller. This class extends the MX_Controller which gives you all of the power of WireDesign’s [HMVC](https://bitbucket.org
This is the place that you want to setup anything that should happen for every page of your site...
The Front_Controller is intended to be used as the base for any public-facing controllers. As such, anything that needs to be done for the front-end can be done here.
Currently, it simply sets the active theme. You could also set the default theme here, if you create a parent theme ‘framework’ to use with all of your sites that you extend with child themes.
This controller forms the base for the Admin Controller. It was broken into two parts in case you needed to create a front-end area that was only accessible to your users, but that was not part of the Admin area and didn’t share the same themes, etc. All changes you make here will affect your Admin Controller’s though, so use with care. If you need to, reset the values in the Admin Controller.
This controller currently...
The final controller sets things up even more for use within the Admin area of your site. That is, the area that Bonfire has setup for you as a base of operations. It currently...
With all of this being loaded, won’t it affect performance? Well, to a very small extent, yes. There are always trade-offs to be made between convenience and speed. In this case, the trade-off is a little bit of extra memory usage. All of the controllers are automatically loaded, and they’re all contained in a single file, so there isn’t the performance hit of extra files being loaded in.
The hope is that having the base controllers available is a simple way to speed up your development time while making a minimal impact on performance.