0 follower

Interface Yiisoft\Session\SessionInterface

Implemented byYiisoft\Session\NullSession, Yiisoft\Session\Session

Session interface defines session data management API.

Public Methods

Hide inherited methods

Method Description Defined By
all() Yiisoft\Session\SessionInterface
clear() Remove session data from runtime. Yiisoft\Session\SessionInterface
close() Write session and close it. Yiisoft\Session\SessionInterface
destroy() Remove session data from runtime and session storage. Yiisoft\Session\SessionInterface
discard() Discard session changes and close session. Yiisoft\Session\SessionInterface
get() Read value from session. Yiisoft\Session\SessionInterface
getCookieParameters() Yiisoft\Session\SessionInterface
getId() Yiisoft\Session\SessionInterface
getName() Yiisoft\Session\SessionInterface
has() Check if session has a value with a given key. Yiisoft\Session\SessionInterface
isActive() Yiisoft\Session\SessionInterface
open() Start session if it is not started yet. Yiisoft\Session\SessionInterface
pull() Read value and remove it afterwards. Yiisoft\Session\SessionInterface
regenerateId() Regenerate session ID keeping data. Yiisoft\Session\SessionInterface
remove() Remove value from session. Yiisoft\Session\SessionInterface
set() Write value into session. Yiisoft\Session\SessionInterface
setId() Yiisoft\Session\SessionInterface

Method Details

Hide inherited methods

all() public abstract method

public abstract all( ): array
return array

All session data.

                public function all(): array;

            
clear() public abstract method

Remove session data from runtime.

public abstract clear( ): void

                public function clear(): void;

            
close() public abstract method

Write session and close it.

public abstract close( ): void

                public function close(): void;

            
destroy() public abstract method

Remove session data from runtime and session storage.

public abstract destroy( ): void

                public function destroy(): void;

            
discard() public abstract method

Discard session changes and close session.

public abstract discard( ): void

                public function discard(): void;

            
get() public abstract method

Read value from session.

public abstract get( string $key, mixed $default null ): mixed
$key string

Key to read value from.

$default mixed

Default value in case there is no value with the key specified. Null by default.

                public function get(string $key, $default = null);

            
getCookieParameters() public abstract method

public abstract getCookieParameters( ): array
return array

Parameters for a session cookie.

                public function getCookieParameters(): array;

            
getId() public abstract method

public abstract getId( ): string|null
return string|null

Current session ID or null if there is no started session.

                public function getId(): ?string;

            
getName() public abstract method

public abstract getName( ): string
return string

Session name.

                public function getName(): string;

            
has() public abstract method

Check if session has a value with a given key.

public abstract has( string $key ): boolean
$key string

The key to check.

                public function has(string $key): bool;

            
isActive() public abstract method

public abstract isActive( ): boolean
return boolean

If session is started.

                public function isActive(): bool;

            
open() public abstract method

Start session if it is not started yet.

public abstract open( ): void

                public function open(): void;

            
pull() public abstract method

Read value and remove it afterwards.

public abstract pull( string $key, mixed $default null ): mixed
$key string

The key to pull value from.

$default mixed

Default value in case there is no value with the key specified. Null by default.

return mixed

The value.

                public function pull(string $key, $default = null);

            
regenerateId() public abstract method

Regenerate session ID keeping data.

public abstract regenerateId( ): void

                public function regenerateId(): void;

            
remove() public abstract method

Remove value from session.

public abstract remove( string $key ): void
$key string

                public function remove(string $key): void;

            
set() public abstract method

Write value into session.

public abstract set( string $key, mixed $value ): void
$key string

Key to write value to.

$value mixed

Value to write.

                public function set(string $key, $value): void;

            
setId() public abstract method

public abstract setId( string $sessionId ): void
$sessionId string

Set session ID.

                public function setId(string $sessionId): void;