list of routes visit

Hello everyone,

a question, yii2 somehow stored routes visited by the user? :unsure:

I created a method to save the information from the last request in a settlement in the session to make the list of requests, but I’m not happy with this way of doing it.


protected function saveCurrentRequest()

    {

        $sesion = \Yii::$app->session;

        $requestTrace = (array) $sesion['requestTrace'];

        $legth = array_unshift($requestTrace, $_REQUEST);

        if ($legth > $this->requesTraceLength) {

            array_pop($requestTrace);

        }

        $sesion['requestTrace'] = $requestTrace;

    }

and i attached this function to the controller before Action Event.

if somebody have a comment, or critic. please help me, and thank :)