Get Controller/action From Path

Is it possible to get the controller and action from a given URL? I am not talking about the current path of the request. I am looking for a function where I can put something like getController(’/site/project/create/id/5’) and it would return the controller/action of project/create.


Try this

echo Yii::app()->urlManager->parseUrl(Yii::app()->request);





Happy coding :)

Unfortunately that only gives me the controller and action for the current URL being accessed. I need to found it for other URLs.

For example, the current URL is /site/object/index. In my controller code (I would be in the ObjectController and actionIndex) I need to find out what the controller/action path is for /site/project/create/id/5

class ObjectController extends Controller {

  function actionIndex() {



       This won't work because I am passing in a string and not a CHttpRequest object 

       I need a function, if exists, which will return the controller/action


    $info = Yii::app()->urlManager->parseUrl('/site/project/create/id/5');