MCP PHP SDK

SessionInterface extends JsonSerializable

Tags
author

Kyrian Obikwelu koshnawaza@gmail.com

Table of Contents

Methods

all()  : array<string, mixed>
Get all attributes of the session.
clear()  : void
Remove all attributes from the session.
forget()  : void
Remove an attribute from the session.
get()  : mixed
Get a specific attribute from the session.
getId()  : Uuid
Get the session ID.
getStore()  : SessionStoreInterface
Get the session store instance.
has()  : bool
Check if an attribute exists in the session.
hydrate()  : void
Set all attributes of the session, typically for hydration.
pull()  : mixed
Get an attribute's value and then remove it from the session.
save()  : bool
Save the session.
set()  : void
Set a specific attribute in the session.

Methods

all()

Get all attributes of the session.

public all() : array<string, mixed>
Return values
array<string, mixed>

forget()

Remove an attribute from the session.

public forget(string $key) : void

Supports dot notation for nested access.

Parameters
$key : string

get()

Get a specific attribute from the session.

public get(string $key[, mixed $default = null ]) : mixed

Supports dot notation for nested access.

Parameters
$key : string
$default : mixed = null

has()

Check if an attribute exists in the session.

public has(string $key) : bool

Supports dot notation for nested access.

Parameters
$key : string
Return values
bool

hydrate()

Set all attributes of the session, typically for hydration.

public hydrate(array<string, mixed> $attributes) : void

This will overwrite existing attributes.

Parameters
$attributes : array<string, mixed>

pull()

Get an attribute's value and then remove it from the session.

public pull(string $key[, mixed $default = null ]) : mixed

Supports dot notation for nested access.

Parameters
$key : string
$default : mixed = null

set()

Set a specific attribute in the session.

public set(string $key, mixed $value[, bool $overwrite = true ]) : void

Supports dot notation for nested access.

Parameters
$key : string
$value : mixed
$overwrite : bool = true

        
On this page

Search results