We are moving our forum in GitHub Discussions. For questions about Phalcon v3/v4 you can visit here and for Phalcon v5 here.

$_GET parameters as action parameters

Is there a way to pass $_GET parameters og HTTP request to action ?

$_GET['id'] =>

public function indexAction($id)


You can prepare the dispatcher arguments before pass them to the dispatched controller/action:


use Phalcon\Dispatcher,
    Phalcon\Mvc\Dispatcher as MvcDispatcher,
    Phalcon\Events\Manager as EventsManager;

$di->set('dispatcher', function() {

    //Create an EventsManager
    $eventsManager = new EventsManager();

    //Attach a listener
    $eventsManager->attach("dispatch:beforeDispatchLoop", function($event, $dispatcher) {

        $keyParams = array();
        foreach ($_GET as $key => $value) {
            $keyParams[$key] = $value;

        //Override parameters

    $dispatcher = new MvcDispatcher();

    return $dispatcher;


It works, but action parametrs does not have same names as $_GET keys, it only write params in asc order. For example:

request string: index.php?_url=/index/help&pid=5&id=10

public function helpAction($id, $lol) { // $id = /index/help // $lol = 5 // }


You have to obtain a ReflectionMethod of the method executed like the one at the link I posted before in the example of the documentation to pass the items in the right order.