PHP Class cookie, kirby

Show file Open project: bastianallgeier/kirby Class Usage Examples

Public Methods

Method Description
get ( string $key, string $default = null ) : mixed Get a cookie value
remove ( string $key, string $domain = '/' ) : mixed Remove a cookie
set ( string $key, string $value, integer $expires = 3600, string $domain = '/' ) : boolean Set a new cookie

Method Details

get() static public method

Get a cookie value
static public get ( string $key, string $default = null ) : mixed
$key string The name of the cookie
$default string The default value, which should be returned if the cookie has not been found
return mixed The found value

remove() static public method

Remove a cookie
static public remove ( string $key, string $domain = '/' ) : mixed
$key string The name of the cookie
$domain string The domain of the cookie
return mixed true: the cookie has been removed, false: the cookie could not be removed

set() static public method

Set a new cookie
static public set ( string $key, string $value, integer $expires = 3600, string $domain = '/' ) : boolean
$key string The name of the cookie
$value string The cookie content
$expires integer The number of seconds until the cookie expires
$domain string The domain to set this cookie for.
return boolean true: the cookie has been created, false: cookie creation failed