O'Reilly logo

CodeIgniter 2 Cookbook by Rob Foster

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating libraries and giving them access to CodeIgniter resources

CodeIgniter allows you to create your own libraries and helpers in circumstances where you don't want or need to place code in controllers or models. Why would you place code in a library and not a helper? Well, some people become quite agitated by the reasoning for this and I'm sure that if you thought hard enough about it, you could come up with some strict rules that defines when a bit of code is a helper or a library. But life is far too short. As long as the code is well documented and is maintainable, stable, and secure, you can do whatever you like. However, as a general rule of thumb:

A library is for code which requires access to other resources, such as needing access ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required