Hi Guys,
After developing in CodeIgniter for awhile, I find it difficult to make decision as to when do i create a custom library and when do i create a custom helper.
I do understand that both allows you to have business logic in it and is reusable across the framework(calling from different controller etc.)
But I strongly believe that the fact the CI core developers are separating libraries from helpers, there got to be a reason behind it and I guess, this is the reason waiting for me to discover and get enlightened.
CI developers out there, pls advise.
i think it's better to include an example.
I could have a
class notification_lib { function set_message() {
}
function get_message() {
}
function update_message() {
}
}
Alternatively, i could also include all the functions into a helper.
In a notification_helper.php file, i will include set_message(), get_message(), update_message()..
Where either way, it still can be reused. So this got me thinking about the decision making point about when do we exactly create a library and a helper particularly in CI.
In a normal(framework-less) php app, the choice is clear as there is no helper, you will just need to create a library in order to reuse codes. But here, in CI, I would like to understand the core developers seperation of libraries and helpers