Skip to content

Latest commit

 

History

History
105 lines (84 loc) · 4.52 KB

Request.md

File metadata and controls

105 lines (84 loc) · 4.52 KB

Http Request Documentation

\Greg\Support\Http\Request is working with http request in an object-oriented way.

Throws: \Greg\Support\Http\RequestException.

Table of contents:

Constants

const TYPE_GET = 'GET';

const TYPE_HEAD = 'HEAD';

const TYPE_POST = 'POST';

const TYPE_PUT = 'PUT';

const TYPE_DELETE = 'DELETE';

const TYPE_CONNECT = 'CONNECT';

const TYPE_OPTIONS = 'OPTIONS';

const TYPE_TRACE = 'TRACE';

const TYPE_PATCH = 'PATCH';

const UPLOAD_ERROR = [
    UPLOAD_ERR_OK         => 'There is no error, the file uploaded with success.',
    UPLOAD_ERR_INI_SIZE   => 'The uploaded file exceeds the upload_max_filesize directive in php.ini.',
    UPLOAD_ERR_FORM_SIZE  => 'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form.',
    UPLOAD_ERR_PARTIAL    => 'The uploaded file was only partially uploaded.',
    UPLOAD_ERR_NO_FILE    => 'No file was uploaded.',
    UPLOAD_ERR_NO_TMP_DIR => 'Missing the temporary folder.',
    UPLOAD_ERR_CANT_WRITE => 'Failed to write file to disk.',
    UPLOAD_ERR_EXTENSION  => 'A PHP extension stopped the file upload.',
];

Magic methods:

Methods description is under construction.

Methods:

  • validate - Validate params;
  • protocol - Get protocol;
  • clientHost - Get client host;
  • serverHost - Get server host;
  • serverAdmin - Get server admin;
  • secured - Get secured state;
  • isSecured - Determine if secured;
  • with - Get requested with;
  • port - Get port;
  • agent - Get agent;
  • ip - Get IP;
  • uri - Get URI;
  • method - Get method;
  • baseUri - Get base URI;
  • uriPath - Get URI path;
  • uriQuery - Get URI query;
  • relativeUri - Get relative URI;
  • relativeUriPath - Get relative URI path;
  • referrer - Get referrer;
  • modifiedSince - Get modified since;
  • match - Get match;
  • time - Get time;
  • microTime - Get micro time;
  • isAjax - Determine if request is an ajax request;
  • header - Get a header;
  • humanReadableFiles - Transform $_FILES to human readable data;
  • has - Determine if has a key or an array of keys in $_REQUEST;
  • hasIndex - Determine if has an index or an array of indexes in $_REQUEST;
  • param - Get a param or an array of params by key from $_REQUEST;
  • paramArray - Get an array param or an array of array params from $_REQUEST;
  • paramIndex - Get a param or an array of params by index from $_REQUEST;
  • paramIndexArray - Get an array param or an array of array params by index from $_REQUEST;
  • hasGet - Determine if has a key or an array of keys in $_GET;
  • hasIndexGet - Determine if has an index or an array of indexes in $_GET;
  • get - Get a param or an array of params by key from $_GET;
  • getArray - Get an array param or an array of array params from $_GET;
  • getIndex - Get a param or an array of params by index from $_GET;
  • getIndexArray - Get an array param or an array of array params by index from $_GET;
  • hasPost - Determine if has a key or an array of keys in $_POST;
  • hasIndexPost - Determine if has an index or an array of indexes in $_POST;
  • post - Get a param or an array of params by key from $_POST;
  • postArray - Get an array param or an array of array params from $_POST;
  • postIndex - Get a param or an array of params by index from $_POST;
  • postIndexArray - Get an array param or an array of array params by index from $_POST;
  • hasFile - Determine if has a key or an array of keys in $_FILES;
  • hasIndexFile - Determine if has an index or an array of indexes in $_FILES;
  • file - Get a param or an array of params by key from $_FILES;
  • fileArray - Get an array param or an array of array params from $_FILES;
  • fileIndex - Get a param or an array of params by index from $_FILES;
  • fileIndexArray - Get an array param or an array of array params by index from $_FILES.

Methods description is under construction.