Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building the Full Request URL like $uri->getFullUrl(); #1966

Closed
SusanthCom opened this issue Aug 18, 2016 · 3 comments
Closed

Building the Full Request URL like $uri->getFullUrl(); #1966

SusanthCom opened this issue Aug 18, 2016 · 3 comments

Comments

@SusanthCom
Copy link

SusanthCom commented Aug 18, 2016

Hi,

To build the full request url that used in Browser/UserAgent by the EndUser/Program, under current implementation, this works :

$container = $app->getContainer();
$request   = $container['request'];
$uri       = $request->getUri();

$fullUrl = (string) $uri;

This type casting trick is not documented in docs and it appears like a hidden undocumented feature. Why not we make this facility, more explicit by implement it as a documented method in Slim 3.X or Slim 4.0 ?

$fullUrl =  $uri->getFullUrl();

Please share your thoughts.

Original discussion Link : http://discourse.slimframework.com/t/building-the-full-request-url/626

Thank You

Susanth K

@JoeBengalen
Copy link
Contributor

I do not like to have to methods doing the exact same logic.

Like I said; Slim makes it pretty clear it supports PSR-7

I do agree that adding this to our own docs might help some users. I guess the place to put it is under URI on page request

BTW; Never retrieve the request from the container. Always use the one given to the callable.

@SusanthCom
Copy link
Author

Yes. @JoeBengalen,

At the minimum, documenting it there, will bring better visibility to this feature; especially to beginners.

Thank you

Susanth K

@geggleto
Copy link
Member

$url = (string)$request->getUri(); should give you the url!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants