I need to generate full URL with symfony, for now I have :
$this->generateUrl('my_route', array('type' => 'param')
This function generate something like : /my_project/xxxxxxxxx
Is there a function like generateUrl
for generate a fully URL ? I need the HTTP and the domain name.
I know I can add them manually but If there is a function for that it's better.
Thanks
It is quite easy:
$this->generateUrl('my_route', array('type' => 'param'), UrlGeneratorInterface::ABSOLUTE_URL);
Don't forget to add:
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With