Namespaces

  • Latte
    • Loaders
    • Macros
    • Runtime
  • Nette
    • Application
      • Responses
      • Routers
      • UI
    • Bridges
      • ApplicationDI
      • ApplicationLatte
      • ApplicationTracy
      • CacheDI
      • CacheLatte
      • DatabaseDI
      • DatabaseTracy
      • DITracy
      • FormsDI
      • FormsLatte
      • Framework
      • HttpDI
      • HttpTracy
      • MailDI
      • ReflectionDI
      • SecurityDI
      • SecurityTracy
    • Caching
      • Storages
    • ComponentModel
    • Database
      • Conventions
      • Drivers
      • Table
    • DI
      • Config
        • Adapters
      • Extensions
    • Forms
      • Controls
      • Rendering
    • Http
    • Iterators
    • Loaders
    • Localization
    • Mail
    • Neon
    • PhpGenerator
      • Traits
    • Reflection
    • Security
    • Tokenizer
    • Utils
  • Tracy
    • Bridges
      • Nette
  • none

Classes

  • Context
  • FileUpload
  • Helpers
  • Request
  • RequestFactory
  • Response
  • Session
  • SessionSection
  • Url
  • UrlScript
  • UserStorage

Interfaces

  • IRequest
  • IResponse
  • ISessionStorage
  • Overview
  • Namespace
  • Class
  • Tree
  • Deprecated
  • Other releases

Class Session

Provides access to session sections as well as session settings and management methods.

Nette\Http\Session uses Nette\SmartObject
Namespace: Nette\Http
Located at Http/Session.php
Methods summary
public
# __construct( Nette\Http\IRequest $request, Nette\Http\IResponse $response )
public
# start( )

Starts and initializes session data.

Starts and initializes session data.

Throws

Nette\InvalidStateException
Nette\InvalidStateException
public boolean
# isStarted( )

Has been session started?

Has been session started?

Returns

boolean
bool
public
# close( )

Ends the current session and store session data.

Ends the current session and store session data.

public
# destroy( )

Destroys all data registered to a session.

Destroys all data registered to a session.

public boolean
# exists( )

Does session exists for the current request?

Does session exists for the current request?

Returns

boolean
bool
public
# regenerateId( )

Regenerates the session ID.

Regenerates the session ID.

Throws

Nette\InvalidStateException
Nette\InvalidStateException
public string
# getId( )

Returns the current session ID. Don't make dependencies, can be changed for each request.

Returns the current session ID. Don't make dependencies, can be changed for each request.

Returns

string
string
public Nette\Http\Session
# setName( string $name )

Sets the session name to a specified one.

Sets the session name to a specified one.

Parameters

$name

Returns

Nette\Http\Session
static
public string
# getName( )

Gets the session name.

Gets the session name.

Returns

string
string
public Nette\Http\SessionSection
# getSection( string $section, string $class = SessionSection::class )

Returns specified session section.

Returns specified session section.

Parameters

$section
$class

Returns

Nette\Http\SessionSection
SessionSection

Throws

Nette\InvalidArgumentException
Nette\InvalidArgumentException
public boolean
# hasSection( string $section )

Checks if a session section exist and is not empty.

Checks if a session section exist and is not empty.

Parameters

$section

Returns

boolean
bool
public Iterator
# getIterator( )

Iteration over all sections.

Iteration over all sections.

Returns

Iterator
\Iterator
public
# clean( )

Cleans and minimizes meta structures. This method is called automatically on shutdown, do not call it directly.

Cleans and minimizes meta structures. This method is called automatically on shutdown, do not call it directly.

Internal

public Nette\Http\Session
# setOptions( array $options )

Sets session options.

Sets session options.

Parameters

$options

Returns

Nette\Http\Session
static

Throws

Nette\NotSupportedException
Nette\NotSupportedException
Nette\InvalidStateException
Nette\InvalidStateException
public array
# getOptions( )

Returns all session options.

Returns all session options.

Returns

array
array
public Nette\Http\Session
# setExpiration( string|integer|DateTimeInterface $time )

Sets the amount of time allowed between requests before the session will be terminated.

Sets the amount of time allowed between requests before the session will be terminated.

Parameters

$time
value 0 means "until the browser is closed"

Returns

Nette\Http\Session
static
public Nette\Http\Session
# setCookieParameters( string $path, string $domain = null, boolean $secure = null, string $samesite = null )

Sets the session cookie parameters.

Sets the session cookie parameters.

Parameters

$path
path
$domain
domain
$secure
secure
$samesite
samesite

Returns

Nette\Http\Session
static
public array
# getCookieParameters( )

Returns the session cookie parameters.

Returns the session cookie parameters.

Returns

array
containing items: lifetime, path, domain, secure, httponly
public Nette\Http\Session
# setSavePath( $path )

Sets path of the directory used to save session data.

Sets path of the directory used to save session data.

Returns

Nette\Http\Session
static
public Nette\Http\Session
# setStorage( Nette\Http\ISessionStorage $storage )

Deprecated

use setHandler().

Returns

Nette\Http\Session
static
public Nette\Http\Session
# setHandler( SessionHandlerInterface $handler )

Sets user session handler.

Sets user session handler.

Returns

Nette\Http\Session
static
Methods used from Nette\SmartObject
__call(), __callStatic(), __get(), __isset(), __set(), __unset(), extensionMethod(), getReflection()
Constants summary
integer DEFAULT_FILE_LIFETIME

Default file lifetime

Default file lifetime

#3*Nette\Utils\DateTime::HOUR
Nette 2.4-20180918 API API documentation generated by ApiGen 2.8.0