Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ jobs:
strategy:
matrix:
operating-system: [ ubuntu-latest ]
php-versions: [ '8.2', '8.3', '8.4' ]
php-versions: [ '8.2', '8.3', '8.4', '8.5' ]
name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }}

steps:
- name: Checkout
uses: actions/checkout@v1
uses: actions/checkout@v5

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand Down Expand Up @@ -48,9 +48,9 @@ jobs:
run: composer stan

- name: Run tests
if: ${{ matrix.php-versions != '8.4' }}
if: ${{ matrix.php-versions != '8.5' }}
run: composer test

- name: Run tests with coverage
if: ${{ matrix.php-versions == '8.4' }}
if: ${{ matrix.php-versions == '8.5' }}
run: composer test:coverage
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
],
"homepage": "https://github.com/odan/session",
"require": {
"php": "~8.2.0 || ~8.3.0 || ~8.4.0",
"php": "~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0",
"psr/http-message": "^1 || ^2",
"psr/http-server-handler": "^1",
"psr/http-server-middleware": "^1"
Expand Down
43 changes: 43 additions & 0 deletions docs/v6/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,49 @@ return [
];
```

### Single action controller usage

Depending on the use case, define `Odan\Session\SessionInterface` or/and ` Odan\Session\SessionManagerInterface`
within the class constructor.

**Example:**

```php
<?php

namespace App\Action;

use Odan\Session\SessionInterface;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;

final class HomeAction
{
private SessionInterface $session;

public function __construct(SessionInterface $session)
{
$this->session = $session;
}

public function __invoke(
ServerRequestInterface $request,
ResponseInterface $response
): ResponseInterface {
// Store a value in session
$this->session->set('message', 'Hello from session');

// or read value from session
$message = $this->session->get('message');

$response->getBody()->write($message);

return $response;
}
}
```


### Session middleware

**Lazy session start**
Expand Down