As far as I know, Yii 2 has no built-in methods to achieve this. You can get only the current controller and its action.
What is the purpose of this? If you really need it, you can write this functionality yourself.
To get all the controllers, you should look for files ending in Conroller . And they can be located in different places of application. For example, in subfolders, modules, sub-modules, etc. Thus, there is more than one place to search.
To get all actions, you must look for all methods with the action prefix in each controller.
Also, don't forget about attached actions in the actions() controller method. Within the framework, they usually end in Action , look, for example, at rest actions. But no one forces you to call it that, so there is a chance that some external actions can only have a different naming convention (for example, if you work in a team and donโt follow this convention).
And you probably need to exclude folders like the provider .
So this is not a trivial task, but perhaps with some inaccuracies. I just donโt understand what is the point of this.
source share