Overview

Namespaces

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

Classes

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

Class Util

Slim HTTP Utilities

This class provides useful methods for handling HTTP requests.

Namespace: Slim\Http
Package: Slim
Author: Josh Lockhart
Since: 1.0.0
Located at thirdparty/Slim/Http/Util.php
Methods summary
public static array|string
# stripSlashesIfMagicQuotes( mixed $rawData, mixed $overrideStripSlashes = null )

Strip slashes from string or array

Strip slashes from string or array

This method strips slashes from its input. By default, this method will only strip slashes from its input if magic quotes are enabled. Otherwise, you may override the magic quotes setting with either TRUE or FALSE as the send argument to force this method to strip or not strip slashes from its input.

Returns

array|string

Var

array|string $rawData
protected static array|string
# _stripSlashes( array|string $rawData )

Strip slashes from string or array

Strip slashes from string or array

Parameters

$rawData
array|string
$rawData

Returns

array|string
public static string
# encrypt( string $data, string $key, string $iv, array $settings = array() )

Encrypt data

Encrypt data

This method will encrypt data using a given key, vector, and cipher. By default, this will encrypt data using the RIJNDAEL/AES 256 bit cipher. You may override the default cipher and cipher mode by passing your own desired cipher and cipher mode as the final key-value array argument.

Parameters

$data
string
$data The unencrypted data
$key
string
$key The encryption key
$iv
string
$iv The encryption initialization vector
$settings
array
$settings Optional key-value array with custom algorithm and mode

Returns

string
public static string
# decrypt( string $data, string $key, string $iv, array $settings = array() )

Decrypt data

Decrypt data

This method will decrypt data using a given key, vector, and cipher. By default, this will decrypt data using the RIJNDAEL/AES 256 bit cipher. You may override the default cipher and cipher mode by passing your own desired cipher and cipher mode as the final key-value array argument.

Parameters

$data
string
$data The encrypted data
$key
string
$key The encryption key
$iv
string
$iv The encryption initialization vector
$settings
array
$settings Optional key-value array with custom algorithm and mode

Returns

string
public static
# encodeSecureCookie( string $value, integer $expires, string $secret, integer $algorithm, integer $mode )

Encode secure cookie value

Encode secure cookie value

This method will create the secure value of an HTTP cookie. The cookie value is encrypted and hashed so that its value is secure and checked for integrity when read in subsequent requests.

Parameters

$value
string
$value The unsecure HTTP cookie value
$expires
integer
$expires The UNIX timestamp at which this cookie will expire
$secret
string
$secret The secret key used to hash the cookie value
$algorithm
integer
$algorithm The algorithm to use for encryption
$mode
integer
$mode The algorithm mode to use for encryption
public static
# decodeSecureCookie( string $value, integer $secret, string $algorithm, integer $mode )

Decode secure cookie value

Decode secure cookie value

This method will decode the secure value of an HTTP cookie. The cookie value is encrypted and hashed so that its value is secure and checked for integrity when read in subsequent requests.

Parameters

$value
string
$value The secure HTTP cookie value
$secret
integer
$expires The UNIX timestamp at which this cookie will expire
$algorithm
string
$secret The secret key used to hash the cookie value
$mode
integer
$algorithm The algorithm to use for encryption
public static
# setCookieHeader( array & $header, string $name, string $value )

Set HTTP cookie header

Set HTTP cookie header

This method will construct and set the HTTP Set-Cookie header. Slim uses this method instead of PHP's native setcookie method. This allows more control of the HTTP header irrespective of the native implementation's dependency on PHP versions.

This method accepts the Slim_Http_Headers object by reference as its first argument; this method directly modifies this object instead of returning a value.

Parameters

$header
array
$header
$name
string
$name
$value
string
$value
public static
# deleteCookieHeader( array & $header, string $name, string $value = array() )

Delete HTTP cookie header

Delete HTTP cookie header

This method will construct and set the HTTP Set-Cookie header to invalidate a client-side HTTP cookie. If a cookie with the same name (and, optionally, domain) is already set in the HTTP response, it will also be removed. Slim uses this method instead of PHP's native setcookie method. This allows more control of the HTTP header irrespective of PHP's native implementation's dependency on PHP versions.

This method accepts the Slim_Http_Headers object by reference as its first argument; this method directly modifies this object instead of returning a value.

Parameters

$header
array
$header
$name
string
$name
$value
string
$value
public static array
# parseCookieHeader( string $header )

Parse cookie header

Parse cookie header

This method will parse the HTTP requst's Cookie header and extract cookies into an associative array.

Parameters

$header
string

Returns

array
GeoApi API documentation generated by ApiGen 2.8.0