title: event that adds a parameter to routing
body: <p>Is it possible to hook up (ideally in the controller) to add an additional parameter to routing?</p>
  
  <p>I know that sounds unclear and at first glance it may sounds ridiculous  - because to reach the controller we already must have routing. But I want to change only default variables.</p>
  
  <p>I'll try to explain what I want to achieve:</p>
  
  <p>Config:</p>
  
  <pre><code>return [
      'router' =&gt; [
          'routes' =&gt; [
              'some' =&gt; [
                  'type'    =&gt; 'Zend\Mvc\Router\Http\Segment',
                  'options' =&gt; [
                      'route'    =&gt; '/some/:project',
                      'defaults' =&gt; [
                          '__NAMESPACE__' =&gt; 'Some\Controller',
                          'controller'    =&gt; 'Some\Controller\Some',
                          'action'        =&gt; 'some',
                          'extra'         =&gt; 'default-value'
                      ],
                  ],
              ]
          ]
      ]
  ];
  </code></pre>
  
  <p>Controller:</p>
  
  <pre><code>class SomeController extends AbstractActionController {
  
      protected $project = null;
  
      public function setEventManager(EventManagerInterface $events)
      {
          parent::setEventManager($events);
          $controller = $this;
          $events-&gt;attach(
              'dispatch', function (\Zend\Mvc\MvcEvent $e) use ($controller) {
                  $params = $e-&gt;getRouteMatch()-&gt;getParams();
                      $this-&gt;project = $params['project'] ;
  
                      // and there should be something that I want to 
                      // achieve but do not know how (and if it is possible)
  
                      if ($this-&gt;project == 1) {
  
                            // magic action which modify config default param 
                            // "extra"  from "default-value" to "changed-value" 
  
                      }
  
  
                      return;
  
              }, 50
          ); 
      }
  
     protected function attachDefaultListeners()
     {
         parent::attachDefaultListeners();
         $eventManager = $this-&gt;getEventManager();
         $eventManager-&gt;attach(
            \Zend\Mvc\MvcEvent::EVENT_DISPATCH,
            function(\Zend\Mvc\MvcEvent $event) {
              $ViewModel = $event-&gt;getResult();
              if ($ViewModel instanceof \Zend\View\Model\ViewModel) {
                  $ViewModel-&gt;setVariable('project',$this-&gt;project);
              }
          },
          -99);
      }
  
  
      public function someAction() {
  
         echo $this-&gt;params()-&gt;fromRoute("extra"); // return "default-value";
  
         // but i want 
  
         echo $this-&gt;params()-&gt;fromRoute("extra"); // return "changed-value";
  
         return new ViewModel();
      } 
  
  }
  </code></pre>
  
  <p>View</p>
  
  <pre><code>&lt;?php 
    echo "project: ".$this-&gt;project; 
    echo $this-&gt;url('some',['project'=&gt;1]); // result: "/some/1" 
  </code></pre>
  
  <p>I know this seems very strange. But for some reason (readable links, seo) is necessary to me.</p>