Documentation

Session extends BaseConfig
in package

Table of Contents

Properties

$cookieName  : string
-------------------------------------------------------------------------- Session Cookie Name --------------------------------------------------------------------------
$DBGroup  : string|null
-------------------------------------------------------------------------- Session Database Group --------------------------------------------------------------------------
$driver  : BaseHandler>
-------------------------------------------------------------------------- Session Driver --------------------------------------------------------------------------
$expiration  : int
-------------------------------------------------------------------------- Session Expiration --------------------------------------------------------------------------
$lockMaxRetries  : int
-------------------------------------------------------------------------- Lock Max Retries --------------------------------------------------------------------------
$lockRetryInterval  : int
-------------------------------------------------------------------------- Lock Retry Interval (microseconds) --------------------------------------------------------------------------
$matchIP  : bool
-------------------------------------------------------------------------- Session Match IP --------------------------------------------------------------------------
$regenerateDestroy  : bool
-------------------------------------------------------------------------- Session Regenerate Destroy --------------------------------------------------------------------------
$savePath  : string
-------------------------------------------------------------------------- Session Save Path --------------------------------------------------------------------------
$timeToUpdate  : int
-------------------------------------------------------------------------- Session Time to Update --------------------------------------------------------------------------

Properties

$cookieName

-------------------------------------------------------------------------- Session Cookie Name --------------------------------------------------------------------------

public string $cookieName = 'ci_session'

The session cookie name, must contain only [0-9a-z_-] characters

$DBGroup

-------------------------------------------------------------------------- Session Database Group --------------------------------------------------------------------------

public string|null $DBGroup = null

DB Group for the database session.

$driver

-------------------------------------------------------------------------- Session Driver --------------------------------------------------------------------------

public BaseHandler> $driver = \CodeIgniter\Session\Handlers\FileHandler::class

The session storage driver to use:

  • CodeIgniter\Session\Handlers\FileHandler
  • CodeIgniter\Session\Handlers\DatabaseHandler
  • CodeIgniter\Session\Handlers\MemcachedHandler
  • CodeIgniter\Session\Handlers\RedisHandler

$expiration

-------------------------------------------------------------------------- Session Expiration --------------------------------------------------------------------------

public int $expiration = 7200

The number of SECONDS you want the session to last. Setting to 0 (zero) means expire when the browser is closed.

$lockMaxRetries

-------------------------------------------------------------------------- Lock Max Retries --------------------------------------------------------------------------

public int $lockMaxRetries = 300

This is used for RedisHandler.

Maximum number of lock acquisition attempts. The default is 300 times. That is lock timeout is about 30 (0.1 * 300) seconds.

$lockRetryInterval

-------------------------------------------------------------------------- Lock Retry Interval (microseconds) --------------------------------------------------------------------------

public int $lockRetryInterval = 100000

This is used for RedisHandler.

Time (microseconds) to wait if lock cannot be acquired. The default is 100,000 microseconds (= 0.1 seconds).

$matchIP

-------------------------------------------------------------------------- Session Match IP --------------------------------------------------------------------------

public bool $matchIP = false

Whether to match the user's IP address when reading the session data.

WARNING: If you're using the database driver, don't forget to update your session table's PRIMARY KEY when changing this setting.

$regenerateDestroy

-------------------------------------------------------------------------- Session Regenerate Destroy --------------------------------------------------------------------------

public bool $regenerateDestroy = false

Whether to destroy session data associated with the old session ID when auto-regenerating the session ID. When set to FALSE, the data will be later deleted by the garbage collector.

$savePath

-------------------------------------------------------------------------- Session Save Path --------------------------------------------------------------------------

public string $savePath = WRITEPATH . 'session'

The location to save sessions to and is driver dependent.

For the 'files' driver, it's a path to a writable directory. WARNING: Only absolute paths are supported!

For the 'database' driver, it's a table name. Please read up the manual for the format with other session drivers.

IMPORTANT: You are REQUIRED to set a valid save path!

$timeToUpdate

-------------------------------------------------------------------------- Session Time to Update --------------------------------------------------------------------------

public int $timeToUpdate = 300

How many seconds between CI regenerating the session ID.


        
On this page

Search results