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

v1.1.1 2018-04-23 20:54 UTC

This package is auto-updated.

Last update: 2024-12-25 12:45:32 UTC


README

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