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 destroy( ): void |
public function destroy(): void;
Discard session changes and close session.
| public abstract discard( ): void |
public function discard(): void;
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);
| public abstract getCookieParameters( ): array | ||
| return | array |
Parameters for a session cookie. |
|---|---|---|
public function getCookieParameters(): array;
| public abstract getId( ): string|null | ||
| 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 has( string $key ): boolean | ||
| $key | string |
The key to check. |
public function has(string $key): bool;
| public abstract isActive( ): boolean | ||
| return | boolean |
If session is started. |
|---|---|---|
public function isActive(): bool;
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);
Regenerate session ID keeping data.
| public abstract regenerateId( ): void |
public function regenerateId(): void;
Remove value from session.
| public abstract remove( string $key ): void | ||
| $key | string | |
public function remove(string $key): void;
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;
Signup or Login in order to comment.