I use the stand alone HttpFoundation
component of Symfony in my MVC app, and native PHP files for the view templates (not Twig).
The functions in the controller can successfully execute a URL redirection to the template path as follows:
return new RedirectResponse('path_to_php_file');
If I pass also parameters with this syntax, how to retrieve them on the PHP file?
return new RedirectResponse('path_to_php_file', 302, array('params' => 'sometext'));
If you are returning the RedirectResponse object to another method of yours, there are getters on the object for the URL
getTargetUrl()
&getStatusCode()
available on or through the RedirectResponse object, and the$headers
is a public property that can be read directly (that comes from the inner Response class).