Package Home

Zend Framework 2 Documentation (Manual)

PHK Home

File: /modules/zend.session.config.standard-config.html

Size:12790
Storage flags:no_autoload,compress/gzip (28%)

Standard Config — Zend Framework 2 2.4.2 documentation

Standard Config

Zend\Session\Config\StandardConfig provides you a basic interface for implementing sessions when not leveraging ext/session. This is utilized more for specialized cases such as when you might have session management done by another system.

Basic Configuration Options

The following configuration options are defined by Zend\Session\Config\StandardConfig.

Option Data Type Description
cache_expire integer Specifies time-to-live for cached session pages in minutes.
cookie_domain string Specifies the domain to set in the session cookie.
cookie_httponly boolean Marks the cookie as accessible only through the HTTP protocol.
cookie_lifetime integer Specifies the lifetime of the cookie in seconds which is sent to the browser.
cookie_path string Specifies path to set in the session cookie.
cookie_secure boolean Specifies whether cookies should only be sent over secure connections.
entropy_length integer Specifies the number of bytes which will be read from the file specified in entropy_file.
entropy_file string Defines a path to an external resource (file) which will be used as an additional entropy.
gc_maxlifetime integer Specifies the number of seconds after which data will be seen as ‘garbage’.
gc_divisor integer Defines the probability that the gc process is started on every session initialization.
gc_probability integer Defines the probability that the gc process is started on every session initialization.
hash_bits_per_character integer Defines how many bits are stored in each character when converting the binary hash data.
name string Specifies the name of the session which is used as cookie name.
remember_me_seconds integer Specifies how long to remember the session before clearing data.
save_path string Defines the argument which is passed to the save handler.
use_cookies boolean Specifies whether the module will use cookies to store the session id.

Basic Usage

A basic example is one like the following:

1
2
3
4
5
6
7
8
9
use Zend\Session\Config\StandardConfig;
use Zend\Session\SessionManager;

$config = new StandardConfig();
$config->setOptions(array(
    'remember_me_seconds' => 1800,
    'name'                => 'zf2',
));
$manager = new SessionManager($config);

Table Of Contents

This Page

Note: You need to stay logged into your GitHub account to contribute to the documentation.

Edit this document

Edit this document

The source code of this file is hosted on GitHub. Everyone can update and fix errors in this document with few clicks - no downloads needed.

  1. Login with your GitHub account.
  2. Go to Standard Config on GitHub.
  3. Edit file contents using GitHub's text editor in your web browser
  4. Fill in the Commit message text box at the end of the page telling why you did the changes. Press Propose file change button next to it when done.
  5. On Send a pull request page you don't need to fill in text anymore. Just press Send pull request button.
  6. Your changes are now queued for review under project's Pull requests tab on GitHub.

For more information about the PHK package format: http://phk.tekwire.net