Skip to content

Commit 9af548e

Browse files
committed
Merge remote-tracking branch 'origin/master'
2 parents 3b6f9d6 + 6448abc commit 9af548e

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,4 +221,9 @@ $app->group('/users', function () {
221221
$this->get('/login', \App\Action\UserLoginIndexAction::class);
222222
$this->get('/logout', \App\Action\UserLogoutAction::class);
223223
})->add(\Odan\Session\SessionMiddleware::class);
224-
```
224+
```
225+
226+
## Similar packages
227+
228+
* https://symfony.com/doc/current/components/http_foundation/sessions.html
229+
* https://github.com/auraphp/Aura.Session

src/SessionMiddleware.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,10 @@ public function __construct(SessionInterface $session)
3636
*/
3737
public function __invoke(ServerRequestInterface $request, ResponseInterface $response, $next): ResponseInterface
3838
{
39-
$this->session->start();
39+
if (!$this->session->isStarted()) {
40+
$this->session->start();
41+
}
42+
4043
$response = $next($request, $response);
4144
$this->session->save();
4245

0 commit comments

Comments
 (0)