1. Go to this page and download the library: Download stefna/session library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
use Psr\Http\Message\ServerRequestInterface;
class Action
{
public function __invoke(ServerRequestInterface $request)
{
$session = $request->getAttribute(\Stefna\Session\SessionStorage::class);
if ($session->getBool('loggedIn')) {
$session->set('loggedIn', false);
}
elseif ($session->has('blocked')) {
$session->remove('blocked');
}
}
}
use Psr\Http\Message\ServerRequestInterface;
use Stefna\Session\Flash\FlashMessage;
use Stefna\Session\Flash\FlashMessages;
use Stefna\Session\Flash\MessageType;
class Action
{
public function __invoke(ServerRequestInterface $request)
{
$flashMessages = $request->getAttribute(FlashMessages::class);
$flashMessages->add(new FlashMessage('Stuff happened', type: MessageType::Live));
}
}
use Psr\Http\Message\ServerRequestInterface;
use Stefna\Session\Flash\FlashMessages;
use Stefna\Session\Flash\MessageType;
class Action
{
public function __invoke(ServerRequestInterface $request)
{
$flashMessages = $request->getAttribute(FlashMessages::class);
$messages = $flashMessages->getMessages(MessageType::Live);
$this->renderGrowMessages($messages);
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.