With Devflow, you have a couple of ways to work with sessions. You can work with native PHP sessions or a session abstraction for PSR-7 with option of using a PSR-15 middleware.
Native PHP Session Configuration
Session configuration is defined in File: ./config/session.php. The available options are:
Usage
<?php
use App\Application\Devflow;
$session = Devflow::$PHP->session;
$session->set('userId', '01HDYV2CNCE0F8RCSY8HADMS0M');
Flash Messages
Store messages in session data until they are retrieved. Bootstrap compatible and sticky messages available.
<?php
use App\Application\Devflow;
$message = Devflow::$PHP->flash;
// Add messages
$message->info('This is an info message');
$message->success('This is a success message');
$message->warning('This is a warning message');
$message->error('This is an error message');
// If you need to check for errors (eg: when validating a form) you can:
if ($message->hasErrors()) {
// There ARE errors
} else {
// There are NO errors
}
// Wherever you want to display the messages simply call:
$message->display();
Sticky Messages
By default, all messages include a close button. The close button can be removed, thus making the message sticky.
To make a message sticky pass true as the third parameter:
