Search code examples
symfonyurlroutescallbackslug

Symfony routage with slug url or callback


I want to implement a url with a callback in it. I have a url like :

http://myserver.com/foo/http://callback.com

The problem is that the route don't match, the slug is an http url.

Here my controller :

/**
 * @Route("/foo/{urlToRedirect}")
 * @Template()
 */
public function loginCallbackAction($urlToRedirect)
{
    die("TODO IMPLEMENT");
}

Solution

  • I find the solution with a requirements with regex :

    /**
     * @Route(
     *          path = "/foo/{urlToRedirect}",
     *          requirements = { "urlToRedirect" = "[a-zA-Z1-9?*=*\/*:*.*]+" }
     * )
     *
     * @Template()
     */
    public function loginCallbackAction($urlToRedirect)
    {
    
        die("TODO IMPLEMENT");
    }