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