Overview

Namespaces

  • Evenement
  • None
  • PHP
  • Psr
    • Http
      • Message
  • Ratchet
    • Http
    • RFC6455
      • Handshake
      • Messaging
    • Server
    • Session
      • Serialize
      • Storage
        • Proxy
    • Wamp
    • WebSocket
  • React
    • EventLoop
      • Tick
      • Timer
    • Socket
    • Stream
  • Symfony
    • Component
      • HttpFoundation
        • Session
          • Attribute
          • Flash
          • Storage
            • Handler
            • Proxy
      • Routing
        • Annotation
        • Exception
        • Generator
          • Dumper
        • Loader
          • DependencyInjection
        • Matcher
          • Dumper
        • Tests
          • Annotation
          • Fixtures
            • AnnotatedClasses
            • OtherAnnotatedClasses
          • Generator
            • Dumper
          • Loader
          • Matcher
            • Dumper

Classes

  • Session

Interfaces

  • SessionBagInterface
  • SessionInterface
  • Overview
  • Namespace
  • Class
  • Tree

Class Session

Session.

Symfony\Component\HttpFoundation\Session\Session implements Symfony\Component\HttpFoundation\Session\SessionInterface, IteratorAggregate, Countable
Namespace: Symfony\Component\HttpFoundation\Session
Author: Fabien Potencier <fabien@symfony.com>
Author: Drak <drak@zikula.org>
Located at Session.php
Methods summary
public
# __construct( Symfony\Component\HttpFoundation\Session\Storage\SessionStorageInterface $storage = null, Symfony\Component\HttpFoundation\Session\Attribute\AttributeBagInterface $attributes = null, Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface $flashes = null )

Constructor.

Constructor.

Parameters

$storage
Symfony\Component\HttpFoundation\Session\Storage\SessionStorageInterface
$storage A SessionStorageInterface instance
$attributes
Symfony\Component\HttpFoundation\Session\Attribute\AttributeBagInterface
$attributes An AttributeBagInterface instance, (defaults null for default AttributeBag)
$flashes
Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface
$flashes A FlashBagInterface instance (defaults null for default FlashBag)
public boolean
# start( )

Starts the session storage.

Starts the session storage.

Returns

boolean
True if session started

Throws

RuntimeException
If session fails to start.

Implementation of

Symfony\Component\HttpFoundation\Session\SessionInterface::start()
public boolean
# has( string $name )

Checks if an attribute is defined.

Checks if an attribute is defined.

Parameters

$name
string
$name The attribute name

Returns

boolean
true if the attribute is defined, false otherwise

Implementation of

Symfony\Component\HttpFoundation\Session\SessionInterface::has()
public mixed
# get( string $name, mixed $default = null )

Returns an attribute.

Returns an attribute.

Parameters

$name
string
$name The attribute name
$default
mixed
$default The default value if not found

Returns

mixed

Implementation of

Symfony\Component\HttpFoundation\Session\SessionInterface::get()
public
# set( string $name, mixed $value )

Sets an attribute.

Sets an attribute.

Parameters

$name
string
$name
$value
mixed
$value

Implementation of

Symfony\Component\HttpFoundation\Session\SessionInterface::set()
public array
# all( )

Returns attributes.

Returns attributes.

Returns

array
Attributes

Implementation of

Symfony\Component\HttpFoundation\Session\SessionInterface::all()
public
# replace( array $attributes )

Sets attributes.

Sets attributes.

Parameters

$attributes
array
$attributes Attributes

Implementation of

Symfony\Component\HttpFoundation\Session\SessionInterface::replace()
public mixed
# remove( string $name )

Removes an attribute.

Removes an attribute.

Parameters

$name
string
$name

Returns

mixed
The removed value or null when it does not exist

Implementation of

Symfony\Component\HttpFoundation\Session\SessionInterface::remove()
public
# clear( )

Clears all attributes.

Clears all attributes.

Implementation of

Symfony\Component\HttpFoundation\Session\SessionInterface::clear()
public boolean
# isStarted( )

Checks if the session was started.

Checks if the session was started.

Returns

boolean

Implementation of

Symfony\Component\HttpFoundation\Session\SessionInterface::isStarted()
public ArrayIterator
# getIterator( )

Returns an iterator for attributes.

Returns an iterator for attributes.

Returns

ArrayIterator
An \ArrayIterator instance

Implementation of

IteratorAggregate::getIterator()
public integer
# count( )

Returns the number of attributes.

Returns the number of attributes.

Returns

integer
The number of attributes

Implementation of

Countable::count()
public boolean
# invalidate( integer $lifetime = null )

Invalidates the current session.

Invalidates the current session.

Parameters

$lifetime
integer
$lifetime Sets the cookie lifetime for the session cookie. A null value will leave the system settings unchanged, 0 sets the cookie to expire with browser session. Time is in seconds, and is not a Unix timestamp.

Returns

boolean
True if session invalidated, false if error

Implementation of

Symfony\Component\HttpFoundation\Session\SessionInterface::invalidate()
public boolean
# migrate( boolean $destroy = false, integer $lifetime = null )

Migrates the current session to a new session id while maintaining all session attributes.

Migrates the current session to a new session id while maintaining all session attributes.

Parameters

$destroy
boolean
$destroy Whether to delete the old session or leave it to garbage collection
$lifetime
integer
$lifetime Sets the cookie lifetime for the session cookie. A null value will leave the system settings unchanged, 0 sets the cookie to expire with browser session. Time is in seconds, and is not a Unix timestamp.

Returns

boolean
True if session migrated, false if error

Implementation of

Symfony\Component\HttpFoundation\Session\SessionInterface::migrate()
public
# save( )

Force the session to be saved and closed.

Force the session to be saved and closed.

Implementation of

Symfony\Component\HttpFoundation\Session\SessionInterface::save()
public string
# getId( )

Returns the session ID.

Returns the session ID.

Returns

string
The session ID

Implementation of

Symfony\Component\HttpFoundation\Session\SessionInterface::getId()
public
# setId( string $id )

Sets the session ID.

Sets the session ID.

Parameters

$id
string
$id

Implementation of

Symfony\Component\HttpFoundation\Session\SessionInterface::setId()
public mixed
# getName( )

Returns the session name.

Returns the session name.

Returns

mixed
The session name

Implementation of

Symfony\Component\HttpFoundation\Session\SessionInterface::getName()
public
# setName( string $name )

Sets the session name.

Sets the session name.

Parameters

$name
string
$name

Implementation of

Symfony\Component\HttpFoundation\Session\SessionInterface::setName()
public MetadataBag
# getMetadataBag( )

Gets session meta.

Gets session meta.

Returns

MetadataBag

Implementation of

Symfony\Component\HttpFoundation\Session\SessionInterface::getMetadataBag()
public
# registerBag( Symfony\Component\HttpFoundation\Session\SessionBagInterface $bag )

Registers a SessionBagInterface with the session.

Registers a SessionBagInterface with the session.

Parameters

$bag
Symfony\Component\HttpFoundation\Session\SessionBagInterface
$bag

Implementation of

Symfony\Component\HttpFoundation\Session\SessionInterface::registerBag()
public Symfony\Component\HttpFoundation\Session\SessionBagInterface
# getBag( string $name )

Gets a bag instance by name.

Gets a bag instance by name.

Parameters

$name
string
$name

Returns

Symfony\Component\HttpFoundation\Session\SessionBagInterface

Implementation of

Symfony\Component\HttpFoundation\Session\SessionInterface::getBag()
public Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface
# getFlashBag( )

Gets the flashbag interface.

Gets the flashbag interface.

Returns

Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface
Properties summary
protected Symfony\Component\HttpFoundation\Session\Storage\SessionStorageInterface $storage
#

Storage driver.

Storage driver.

Ratchet API documentation generated by ApiGen 2.8.0