Simple Http Component to work with Http request, response and urls.
composer require flextype-components/http
Set header status
Http::setResponseStatus(404);
Redirects the browser to a page specified by the url argument.
Http::redirect('http://flextype.org');
Set one or multiple request headers.
Http::setRequestHeaders('Location: http://flextype.org');
Get
$action = Http::get('action');
Post
$username = Http::post('username');
Returns whether this is an ajax request or not
if (Http::isAjaxRequest()) {
// do something...
}
Terminate request
Http::requestShutdown();
Gets the base URL
echo Http::getBaseUrl();
Gets current URL
echo Http::getCurrentUrl();
Get Uri String
$uri_string = Http::getUriString();
Get Uri Segments
$uri_segments = Http::getUriSegments();
Get Uri Segment
$uri_segment = Http::getUriSegment(1);
See LICENSE