use external function in Yii Controller (Helper function)
The way we are doing it is this:
We have a file in lib called SharedFunctions.php, and lib.* are imported in config/main, so that Yii, autoloads the SharedFunctions file..
In SharedFunctions.php file
Class SharedFunctions{ public static function lib() { return new SharedFunctions(); } public function myfunction($params) { .... }}
Now anywhere in Yii app we can use any function defined in the SharedFunctions file as
SharedFunctions::lib()->myfunction($params);