* name: The cookie name (null [ommited] by default)
* id: The session id (null [ommited] by default)
* lifetime: Cookie lifetime
* path: Cookie path
* domain: Cookie domain
* secure: Cookie secure
* httponly: Cookie http only
The default values for most options are those returned by the session_get_cookie_params() function
public __construct ( array $options = [] ) | ||
$options | array | An associative array of session options |
/** * Constructor. * * @param \PDO $db A PDO instance * @param array $options An associative array of session options * @param array $dbOptions An associative array of DB options * * @throws \InvalidArgumentException When "db_table" option is not provided * * @see NativeSessionStorage::__construct() */ public function __construct(\PDO $db, array $options = array(), array $dbOptions = array()) { if (!array_key_exists('db_table', $dbOptions)) { throw new \InvalidArgumentException('You must provide the "db_table" option for a PdoSessionStorage.'); } $this->db = $db; $this->dbOptions = array_merge(array('db_id_col' => 'sess_id', 'db_data_col' => 'sess_data', 'db_time_col' => 'sess_time'), $dbOptions); parent::__construct($options); }
/** * Class constructor. * * @throws InvalidArgumentException if the "collection" option is not provided * @throws InvalidArgumentException if the "db_name" option is not provided */ public function __construct(\Mongo $con, array $options = array()) { $options = array_merge(array('id_field' => 'sess_id', 'data_field' => 'sess_data', 'time_field' => 'sess_time'), $options); if (!isset($options['db_name'])) { throw new \InvalidArgumentException('You must provide the "db_name" option for the MongoDBSessionStorage.'); } if (!isset($options['collection'])) { throw new \InvalidArgumentException('You must provide the "collection" option for the MongoDBSessionStorage.'); } parent::__construct($options); $this->db = $con->selectDB($options['db_name']); }
/** * Redis session storage constructor * * @param Client $db Redis database connection * @param array $options Session options * @param string $prefix Prefix to use when writing session data */ public function __construct(Client $db, $options = array(), $prefix = 'session') { $this->db = $db; $options['prefix'] = $prefix; parent::__construct($options); }
public function __construct(Connection $con, $tableName = 'sessions', array $options = array()) { parent::__construct($options); $this->con = $con; $this->tableName = $tableName; }