public class Cookie

class.cookie.php #16

The Cookie class is a wrapper to save Symphony cookies. Typically this is used to maintain if an Author is logged into Symphony, or by extensions to determine similar things. The Cookie class is tightly integrated with PHP's $_SESSION global and it's related functions.

Methods

void __construct(string $index, integer $timeout, string $path, string $domain, boolean $httpOnly)

Constructor for the Cookie class intialises all class variables with the given parameters. Most of the parameters map to PHP's setcookie function. It creates a new Session object via the $this->__init()

Parameters
  • $index stringThe prefix to used to namespace all Symphony cookies

  • $timeout integerThe Time to Live for a cookie, by default this is zero, meaning the cookie never expires

  • $path stringThe path the cookie is valid for on the domain

  • $domain stringThe domain this cookie is valid for

  • $httpOnly booleanWhether this cookie can be read by Javascript. By default the cookie cannot be read by Javascript

See Also
void expire()

Expires the current $_SESSION by unsetting the Symphony namespace ($this->_index). If the $_SESSION is empty, the function will destroy the entire $_SESSION

See Also
string|null get(string $name)

Accessor function for properties in the $_SESSION array

Parameters
  • $name stringThe name of the property to retrieve (optional)

Returns

The value of the property, or null if it does not exist. If no $name is provided, return the entire Cookie.

void set(string $name, string $value)

A basic setter, which will set a value to a given property in the $_SESSION array, stored in the key of $this->_index

Parameters
  • $name stringThe name of the property

  • $value stringThe value of the property

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details