Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laminas Session Laravel Package

laminas/laminas-session

Laminas Session provides object-oriented PHP session management: session containers, validators, save handlers, and configuration utilities. Supports secure, testable session workflows for Laminas/Mezzio apps, including storage options and session lifecycle control.

View on GitHub
Deep Wiki
Context7

Session Storage

laminas-session comes with a standard set of storage handlers. Storage handlers are the intermediary between when the session starts and when the session writes and closes. The default session storage is Laminas\Session\Storage\SessionArrayStorage.

Array Storage

Laminas\Session\Storage\ArrayStorage provides a facility to store all information in an ArrayObject. This storage method is likely incompatible with 3rd party libraries and all properties will be inaccessible through the $_SESSION superglobal. Additionally ArrayStorage will not automatically repopulate the storage container in the case of each new request and would have to manually be re-populated.

Basic Usage

use Laminas\Session\Storage\ArrayStorage;
use Laminas\Session\SessionManager;

$populateStorage = ['foo' => 'bar'];
$storage         = new ArrayStorage($populateStorage);
$manager         = new SessionManager();
$manager->setStorage($storage);

Session Storage

Laminas\Session\Storage\SessionStorage replaces $_SESSION, providing a facility to store all information in an ArrayObject. This means that it may not be compatible with 3rd party libraries, although information stored in the $_SESSION superglobal should be available in other scopes.

Basic Usage

use Laminas\Session\Storage\SessionStorage;
use Laminas\Session\SessionManager;

$manager = new SessionManager();
$manager->setStorage(new SessionStorage());

Session Array Storage

Laminas\Session\Storage\SessionArrayStorage provides a facility to store all information directly in the $_SESSION superglobal. This storage class provides the most compatibility with 3rd party libraries and allows for directly storing information into $_SESSION.

Basic Usage

use Laminas\Session\Storage\SessionArrayStorage;
use Laminas\Session\SessionManager;

$manager = new SessionManager();
$manager->setStorage(new SessionArrayStorage());

Custom Storage

To create a custom storage container, you must implement Laminas\Session\Storage\StorageInterface. This interface extends each of ArrayAccess, Traversable, Serializable, and Countable, and it is in the methods those define that the majority of implementation occurs. The following methods must also be implemented:

public function getRequestAccessTime() : int;

public function lock(int|string $key = null) : void;
public function isLocked(int|string $key = null) : bool;
public function unlock(int|string $key = null) : void;

public function markImmutable() : void;
public function isImmutable() : bool;

public function setMetadata(string $key, mixed $value, bool $overwriteArray = false) : void;
public function getMetadata(string $key = null) : mixed;

public function clear(int|string $key = null) : void;

public function fromArray(array $array) : void;
public function toArray(bool $metaData = false) : array;
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
terminal42/code-quality-tools
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky