Skip to content

flextype-components/http

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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