aeforge / session
AEForge Session component. Providing a way to deal with session across the application
V1.0.0
2023-10-27 04:29 UTC
Requires
- php: >=8.0.0
README
AEForge Session component. Providing a way to deal with session across the application.
Installation
To install via composer:
composer require aeforge/session
To clone the project:
https://github.com/aeforge/Session.git
Usage/Examples
Example
use Aeforge\Session\Session; // Start a new session instance $session = new Session(); // Add expiring time to 60 (in minutes) $session->register(60); //Set a normal session key and value $session->set("session_key", "session_value"); //Set a flashed session key and value (useful for forms errors for example) $session->flash("flashed_key", "flashed_value"); // Get a normal session value using a key echo $session->get("hello"); //Get a flashed session value using a key echo $session->getFlashed("hello"); // Clears both the flash session array and the data session array(normal session) $session->clear(); // Clear the data array only(normal session) $session->clearData(); // Clear the flashed array only $session->clearFlashed(); // Ends the session $session->destroy(); // Regenerates the session id $session->regenerate(); // Check if the session expired $session->isExpired ();