Property | Type | Description | |
---|---|---|---|
$domain | string | Hosts to which this cookie will be sent (RFC 6265, 4.1.2.3) | |
$expiresTimestamp | integer | Unix timestamp of the expiration date / time or 0 for "session" expiration (RFC 6265, 4.1.2.1) | |
$httpOnly | boolean | ||
$maximumAge | integer | Number of seconds until the cookie expires (RFC 6265, 4.1.2.2) | |
$name | string | Cookie Name, a token (RFC 6265, 4.1.1) | |
$path | string | ||
$secure | boolean | ||
$value | string |
Method | Description | |
---|---|---|
__construct ( string $name, mixed $value = null, integer | DateTime $expires, integer $maximumAge = null, string $domain = null, string $path = '/', boolean $secure = false, boolean $httpOnly = true ) | Constructs a new Cookie object | |
__toString ( ) : string | Renders the field value suitable for a HTTP "Set-Cookie" header. | |
createFromRawSetCookieHeader ( string $header ) : |
Creates a cookie (an instance of this class) by a provided raw header string like "foo=507d9f20317a5; path=/; domain=.example.org" This is is an implementation of the algorithm explained in RFC 6265, Section 5.2 A basic statement of this algorithm is to "ignore the set-cookie-string entirely" in case a required condition is not met. In these cases this function will return NULL rather than the created cookie. | |
expire ( ) : void | Marks this cookie for removal. | |
getDomain ( ) : string | Returns the domain this cookie is valid for. | |
getExpires ( ) : integer | Returns the date and time of the Expires attribute, if any. | |
getMaximumAge ( ) : integer | Returns the number of seconds until the cookie expires, if defined. | |
getName ( ) : string | Returns the name of this cookie | |
getPath ( ) : string | Returns the path this cookie is valid for. | |
getValue ( ) : mixed | Returns the value of this cookie | |
isExpired ( ) : boolean | Tells if this cookie is expired and will be removed in the user agent when it received the response containing this cookie. | |
isHttpOnly ( ) : boolean | Tells if this cookie should only be used through the HTTP protocol. | |
isSecure ( ) : boolean | Tells if the cookie was flagged to be sent over "secure" channels only. | |
setValue ( mixed $value ) : void | Sets the value of this cookie |
public __construct ( string $name, mixed $value = null, integer | DateTime $expires, integer $maximumAge = null, string $domain = null, string $path = '/', boolean $secure = false, boolean $httpOnly = true ) | ||
$name | string | The cookie name as a valid token (RFC 2616) |
$value | mixed | The value to store in the cookie. Must be possible to cast into a string. |
$expires | integer | DateTime | Date and time after which this cookie expires. |
$maximumAge | integer | Number of seconds until the cookie expires. |
$domain | string | The host to which the user agent will send this cookie |
$path | string | The path describing the scope of this cookie |
$secure | boolean | If this cookie should only be sent through a "secure" channel by the user agent |
$httpOnly | boolean | If this cookie should only be used through the HTTP protocol |
public __toString ( ) : string | ||
return | string |
public static createFromRawSetCookieHeader ( string $header ) : |
||
$header | string | The Set-Cookie string without the actual "Set-Cookie:" part |
return |
public getExpires ( ) : integer | ||
return | integer | A unix timestamp or 0 |
public getMaximumAge ( ) : integer | ||
return | integer | The maximum age in seconds, or NULL if none has been defined. |
public isHttpOnly ( ) : boolean | ||
return | boolean | State of the "HttpOnly" attribute |
protected string $domain | ||
return | string |
protected int $expiresTimestamp | ||
return | integer |
protected int $maximumAge | ||
return | integer |
protected string $name | ||
return | string |