BasePath processing is missing
esetnik opened this issue · comments
Ethan Setnik commented
According to the documentation
The PSR-7 Request object’s URI is itself an object that provides the following methods to inspect the HTTP request’s URL parts:
getScheme()
getAuthority()
getUserInfo()
getHost()
getPort()
getPath()
getBasePath()
getQuery() (returns the full query string, e.g. a=1&b=2)
getFragment()
getBaseUrl()
You can get the query parameters as an associative array on the Request object using getQueryParams().
Base Path
If your Slim application's front-controller lives in a physical subdirectory beneath your document root directory, you can fetch the HTTP request's physical base path (relative to the document root) with the Uri object's getBasePath() method. This will be an empty string if the Slim application is installed in the document root's top-most directory.
Slim v3 implemented the basePath
processing as per https://github.com/slimphp/Slim/blob/3.x/Slim/Http/Uri.php#L204
Pierre B. commented
It handled base path by making assumptions with REQUEST_URI
which is unreliable and that’s why it was removed.
Rob Allen commented
Slim-Psr7 is intended to be a "pure" implementation of PSR-7. As such additions such as these properly belong in Slim-Http, where getBaseUrl()
already exists.