Overview

Namespaces

  • api
  • config
  • database
  • PHP
  • Slim
    • Exception
    • Http
    • Middleware
  • utiliy

Classes

  • Headers
  • Request
  • Response
  • Util
  • Overview
  • Namespace
  • Class
  • Tree

Class Request

Slim HTTP Request

This class provides a human-friendly interface to the Slim environment variables; environment variables are passed by reference and will be modified directly.

Namespace: Slim\Http
Package: Slim
Author: Josh Lockhart
Since: 1.0.0
Located at thirdparty/Slim/Http/Request.php
Methods summary
public
# __construct( array $env )

Constructor

Constructor

Parameters

$env
array
$env

See

Slim\Environment
public string
# getMethod( )

Get HTTP method

Get HTTP method

Returns

string
public boolean
# isGet( )

Is this a GET request?

Is this a GET request?

Returns

boolean
public boolean
# isPost( )

Is this a POST request?

Is this a POST request?

Returns

boolean
public boolean
# isPut( )

Is this a PUT request?

Is this a PUT request?

Returns

boolean
public boolean
# isDelete( )

Is this a DELETE request?

Is this a DELETE request?

Returns

boolean
public boolean
# isHead( )

Is this a HEAD request?

Is this a HEAD request?

Returns

boolean
public boolean
# isOptions( )

Is this a OPTIONS request?

Is this a OPTIONS request?

Returns

boolean
public boolean
# isAjax( )

Is this an AJAX request?

Is this an AJAX request?

Returns

boolean
public boolean
# isXhr( )

Is this an XHR request? (alias of Slim_Http_Request::isAjax)

Is this an XHR request? (alias of Slim_Http_Request::isAjax)

Returns

boolean
public array|mixed|null
# params( string $key = null )

Fetch GET and POST data

Fetch GET and POST data

This method returns a union of GET and POST data as a key-value array, or the value of the array key if requested; if the array key does not exist, NULL is returned.

Parameters

$key
string
$key

Returns

array|mixed|null
public array|mixed|null
# get( string $key = null )

Fetch GET data

Fetch GET data

This method returns a key-value array of data sent in the HTTP request query string, or the value of the array key if requested; if the array key does not exist, NULL is returned.

Parameters

$key
string
$key

Returns

array|mixed|null
public array|mixed|null
# post( string $key = null )

Fetch POST data

Fetch POST data

This method returns a key-value array of data sent in the HTTP request body, or the value of a hash key if requested; if the array key does not exist, NULL is returned.

Parameters

$key
string
$key

Returns

array|mixed|null

Throws

RuntimeException
If environment input is not available
public array|mixed|null
# put( string $key = null )

Fetch PUT data (alias for \Slim\Http\Request::post)

Fetch PUT data (alias for \Slim\Http\Request::post)

Parameters

$key
string
$key

Returns

array|mixed|null
public array|mixed|null
# delete( string $key = null )

Fetch DELETE data (alias for \Slim\Http\Request::post)

Fetch DELETE data (alias for \Slim\Http\Request::post)

Parameters

$key
string
$key

Returns

array|mixed|null
public array|string|null
# cookies( string $key = null )

Fetch COOKIE data

Fetch COOKIE data

This method returns a key-value array of Cookie data sent in the HTTP request, or the value of a array key if requested; if the array key does not exist, NULL is returned.

Parameters

$key
string
$key

Returns

array|string|null
public boolean
# isFormData( )

Does the Request body contain parseable form data?

Does the Request body contain parseable form data?

Returns

boolean
public mixed
# headers( string $key = null, mixed $default = null )

Get Headers

Get Headers

This method returns a key-value array of headers sent in the HTTP request, or the value of a hash key if requested; if the array key does not exist, NULL is returned.

Parameters

$key
string
$key
$default
mixed
$default The default value returned if the requested header is not available

Returns

mixed
public string
# getBody( )

Get Body

Get Body

Returns

string
public string
# getContentType( )

Get Content Type

Get Content Type

Returns

string
public string|null
# getMediaType( )

Get Media Type (type/subtype within Content Type header)

Get Media Type (type/subtype within Content Type header)

Returns

string|null
public array
# getMediaTypeParams( )

Get Media Type Params

Get Media Type Params

Returns

array
public string|null
# getContentCharset( )

Get Content Charset

Get Content Charset

Returns

string|null
public integer
# getContentLength( )

Get Content-Length

Get Content-Length

Returns

integer
public string
# getHost( )

Get Host

Get Host

Returns

string
public string
# getHostWithPort( )

Get Host with Port

Get Host with Port

Returns

string
public integer
# getPort( )

Get Port

Get Port

Returns

integer
public string
# getScheme( )

Get Scheme (https or http)

Get Scheme (https or http)

Returns

string
public string
# getScriptName( )

Get Script Name (physical path)

Get Script Name (physical path)

Returns

string
public string
# getRootUri( )

LEGACY: Get Root URI (alias for Slim_Http_Request::getScriptName)

LEGACY: Get Root URI (alias for Slim_Http_Request::getScriptName)

Returns

string
public string
# getPath( )

Get Path (physical path + virtual path)

Get Path (physical path + virtual path)

Returns

string
public string
# getPathInfo( )

Get Path Info (virtual path)

Get Path Info (virtual path)

Returns

string
public string
# getResourceUri( )

LEGACY: Get Resource URI (alias for Slim_Http_Request::getPathInfo)

LEGACY: Get Resource URI (alias for Slim_Http_Request::getPathInfo)

Returns

string
public string
# getUrl( )

Get URL (scheme + host [ + port if non-standard ])

Get URL (scheme + host [ + port if non-standard ])

Returns

string
public string
# getIp( )

Get IP

Get IP

Returns

string
public string|null
# getReferrer( )

Get Referrer

Get Referrer

Returns

string|null
public string|null
# getReferer( )

Get Referer (for those who can't spell)

Get Referer (for those who can't spell)

Returns

string|null
public string|null
# getUserAgent( )

Get User Agent

Get User Agent

Returns

string|null
Constants summary
string METHOD_HEAD 'HEAD'
#
string METHOD_GET 'GET'
#
string METHOD_POST 'POST'
#
string METHOD_PUT 'PUT'
#
string METHOD_DELETE 'DELETE'
#
string METHOD_OPTIONS 'OPTIONS'
#
string METHOD_OVERRIDE '_METHOD'
#
Properties summary
protected static array $formDataMediaTypes array('application/x-www-form-urlencoded')
#
protected array $env
#
GeoApi API documentation generated by ApiGen 2.8.0