Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can i get the absolute url of route with symfony

I am using symfony and I want to get the url of a specific route , my route is like this

project_sign_in:
    pattern:  /signin
    defaults: { _controller: ProjectContactBundle:User:signIn }

i want to generate the url from this route so i can get

localhost/app_dev.php/signin or {SERVER-ADDRESS}/app_dev/signin

if I was browsing the server.

like image 722
user2784013 Avatar asked May 19 '14 08:05

user2784013


1 Answers

Using the Routing Component at version 4.0:

<?php
use Symfony\Component\Routing\Generator\UrlGenerator;

UrlGenerator->generate('project_sign_in', [], UrlGenerator::ABSOLUTE_URL);
like image 146
Michael B. Avatar answered Sep 18 '22 21:09

Michael B.