Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regex in zend-expressive-zendrouter #22

mano87 opened this issue Feb 27, 2017 · 1 comment


None yet
2 participants
Copy link

commented Feb 27, 2017

we will migrate our ZF2 MVC Application to ZF3 Expressive. For some functions we use Regex to build the routes. When can I use Regex in zend-expressive-zendrouter?

For example:

'vcalendar' => [
  'type' => 'regex',
  'options' => [
    'regex' => '/vcalendar/(?<room>[0-9]+)(\.(?<format>(html|ics)))?',
    'defaults' => [
      'action' => 'vcalendar',
      'format' => 'ics'
    'spec' => '/vcalendar/%room%.%format%',

This comment has been minimized.

Copy link

commented Mar 1, 2017

You can't, at least not using the Expressive API for attaching routes to middleware, due to a need to keep the API compatible between all routing implementations. In particular, we found that HTTP method negotiation, while supported directly in other routing implementations, was something we had to "hack" around to make work with zend-router; we ended up injecting a method route as a child route on the primary route to make it happen.

We could potentially support this by allowing you to provide the route type via route options (which would be handled in the ZendRouter::injectRoute() method); if anybody would like to try their hand at this, I'd welcome a pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.