I am developing an MVC framework and I have a problem creating flexible code / framework when declaring helper classes
class Controller { public $helper = []; public function load_helper($helper) { require_once(DIR_HELPER . $helper . '.php'); $lc_helper = StrToLower($helper); $helper_arr[$lc_helper] = new $helper; $this->helper[$lc_helper] = $helper_arr[$lc_helper]; } }
// I call the function in my controllers, e.g.
Class Home Extends Controller { $this->load_helper('Form'); $this->helper['form']-><class function>; }
I want to call a function as follows:
$this->form-><class function>;
I cannot use extraction for public functions, but I have seen frameworks that can do this.
I hope someone has an idea and someone can understand my question, thanks in advance.
source share