PHP Class Webiny\Component\Http\Cookie

Inheritance: use trait Webiny\Component\StdLib\StdLibTrait, use trait Webiny\Component\StdLib\FactoryLoaderTrait, use trait Webiny\Component\StdLib\SingletonTrait
显示文件 Open project: Webiny/Framework Class Usage Examples

Public Methods

Method Description
delete ( string $name ) : boolean Remove the given cookie.
get ( string $name ) : string | boolean Get the cookie.
getConfig ( ) : ConfigObject Returns cookie config from Http object.
save ( string $name, string $value, integer $expiration = null, boolean $httpOnly = true, string $path = '/' ) : boolean Save a cookie.

Protected Methods

Method Description
init ( ) Constructor.

Private Methods

Method Description
getStorage ( ConfigObject $config = null ) : Webiny\Component\Http\Cookie\CookieStorageInterface Get cookie storage driver.

Method Details

delete() public method

Remove the given cookie.
public delete ( string $name ) : boolean
$name string Cookie name.
return boolean True if cookie was deleted, or if it doesn't exist, otherwise false.

get() public method

Get the cookie.
public get ( string $name ) : string | boolean
$name string Cookie name.
return string | boolean String if cookie is found, false if cookie is not found.

getConfig() public static method

Returns cookie config from Http object.
public static getConfig ( ) : ConfigObject
return Webiny\Component\Config\ConfigObject

init() protected method

Constructor.
protected init ( )

save() public method

Save a cookie.
public save ( string $name, string $value, integer $expiration = null, boolean $httpOnly = true, string $path = '/' ) : boolean
$name string Name of the cookie.
$value string Cookie value.
$expiration integer Timestamp when the cookie should expire.
$httpOnly boolean Is the cookie https-only or not.
$path string Path under which the cookie is accessible.
return boolean True if cookie was save successfully, otherwise false.