Skip to content

Latest commit

 

History

History
79 lines (61 loc) · 1.33 KB

README.md

File metadata and controls

79 lines (61 loc) · 1.33 KB

Http Component

version MIT License

Simple Http Component to work with Http request, response and urls.

Installation

composer require flextype-components/http

Usage

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);

License

See LICENSE