Interface Yiisoft\Session\SessionInterface
| Implemented by | Yiisoft\Session\NullSession, Yiisoft\Session\Session |
|---|
Session interface defines session data management API.
Public Methods
Method Details
Remove session data from runtime and session storage.
| public abstract void destroy ( ) |
public function destroy(): void;
Discard session changes and close session.
| public abstract void discard ( ) |
public function discard(): void;
Read value from session.
| public abstract mixed get ( string $key, mixed $default = null ) | ||
| $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);
| public abstract array getCookieParameters ( ) | ||
| return | array |
Parameters for a session cookie. |
|---|---|---|
public function getCookieParameters(): array;
| public abstract string|null getId ( ) | ||
| return | string|null |
Current session ID or null if there is no started session. |
|---|---|---|
public function getId(): ?string;
Check if session has a value with a given key.
| public abstract boolean has ( string $key ) | ||
| $key | string |
The key to check. |
public function has(string $key): bool;
| public abstract boolean isActive ( ) | ||
| return | boolean |
If session is started. |
|---|---|---|
public function isActive(): bool;
Read value and remove it afterwards.
| public abstract mixed pull ( string $key, mixed $default = null ) | ||
| $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);
Regenerate session ID keeping data.
| public abstract void regenerateId ( ) |
public function regenerateId(): void;
Remove value from session.
| public abstract void remove ( string $key ) | ||
| $key | string | |
public function remove(string $key): void;
Write value into session.
| public abstract void set ( string $key, mixed $value ) | ||
| $key | string |
Key to write value to. |
| $value | mixed |
Value to write. |
public function set(string $key, $value): void;
Signup or Login in order to comment.