We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Route annotation: parametros regex

Hey Guys,

I'm using annotations for my routes, but I can make them get validated using a regular expression in the following way:

<?php

/**
 *@Get("/date/{date:([0-9]{4}-[0-9]{1,2}-[0-9]{1,2})}
 */
 public function dateAction($date){

 }

If I connect to https://xxx/date/2015-01-01, it returns a 404?

Someone can help me? Thanks in advance for your help,



6.4k
Accepted
answer

Your annotation is missing ") at the end. With that added it's working for me in Phalcon 1.3.4