I need to access some functions in multiple controllers in a CodeIgniter application. At the moments the functions are really basic and a few, For example:
generate_random_key() //just a random string
is_logged() //check if user is logged or not
logged_user_only() //if unlogged, redirect
unlogged_user_only() //if logged, redirect
As these functions are related to login, I can either put them in a helper file and place in Application/helpers/login_helper.php
OR
i can extend the CI_Controller, by creating MY_Controller.php
and put it in Application/Core/MY_Controller.php
Both of the methods work, but I am wondering which one fits better for this kind of task. I think there should be some rules, when the Controller should be extended or when the helper should be used?