Session Management
The documentation is constantly evolving and updated alongside the project's progress. Since it is developed in parallel with the code, some sections may temporarily refer to earlier versions of the system-these are gradually adapted to the current state of the application. If you notice any outdated information, please report it or open an Issue / Pull Request.
Documentation
# Session Management
# Overview
The SessionManager provides a simple interface for handling PHP sessions.
# Basic Usage
use Dbm\Infrastructure\Session\SessionManager;
$session = new SessionManager();
$session->start();
# Set Session
$session->setSession('user_id', 1);
# Get Session
$userId = $session->getSession('user_id');
# Remove Session
$session->unsetSession('user_id');
# Destroy Session
$session->destroySession();
# Pop (Get & Remove)
$message = $session->pop('flash_message');
# Reference Access
$data = &$session->getSessionByReference('cart');
$data[] = 'product_id';
# Notes
setSession(),getSession(),hasSession(),unsetSession(),pop(), anddestroySession()operate on$_SESSION; they do not start the session. Start it explicitly or use the platformStartSessionMiddleware.getSessionByReference()andregenerateId()start a session when needed.getSession()andpop()returnnullwhen the key is absent.- Useful for flash messages and carts
# Best Practices
- Use sessions only for small data
- Avoid storing large objects
- Always secure session cookies
Documentation List
01. GETTING STARTED
02. CORE CONCEPTS
03. HTTP AND ROUTING
04. DATA
05. VALIDATION
06. INFRASTRUCTURE
07. SECURITY
08. PRESENTATION
09. LOCALIZATION
10. RUNTIME
11. MODULES
12. PLATFORM LIBRARIES