Skip to content

Commit 3c18e85

Browse files
committed
update dependencies
1 parent 6bc9f09 commit 3c18e85

3 files changed

Lines changed: 17 additions & 21 deletions

File tree

README.md

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,13 @@ composer require innmind/http-session
1919
```php
2020
use Innmind\HttpSession\Manager\Native;
2121
use Innmind\Http\{
22-
Message\Response\Response,
23-
Message\ServerRequest,
24-
Message\StatusCode,
22+
Response,
23+
Response\StatusCode,
24+
ServerRequest,
2525
Headers,
2626
Header\SetCookie,
27-
Header\CookieParameter\HttpOnly,
28-
Header\CookieParameter\Domain,
29-
Header\Parameter\Parameter,
27+
Header\SetCookie\Directive,
28+
Header\SetCookie\Domain,
3029
};
3130

3231
$manager = Native::of();
@@ -39,18 +38,20 @@ $session = $manager->start($request)->match(
3938
// inject some data in the session
4039
$manager->save($session);
4140

42-
$response = new Response(
43-
$code = StatusCode::ok,
41+
$response = Response::of(
42+
StatusCode::ok,
4443
$request->protocolVersion(),
4544
Headers::of(
4645
SetCookie::of(
47-
new Parameter($session->name()->toString(), $session->id()->toString()),
48-
new HttpOnly,
49-
new Domain($request->url()->authority()->host()),
46+
$session->name()->toString(),
47+
$session->id()->toString(),
48+
Directive::httpOnly,
49+
Domain::of($request->url()->authority()->host()),
5050
),
5151
),
5252
);
5353
// send the response
5454
```
5555

56-
**Note**: you should take a look at [`innmint/http-server`](https://github.com/Innmind/HttpServer) in order to know how to have access to an instance of `ServerRequest` and send the `Response`.
56+
> [!NOTE]
57+
> You should take a look at [`innmind/http-server`](https://github.com/Innmind/HttpServer) in order to know how to have access to an instance of `ServerRequest` and send the `Response`.

composer.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@
1616
},
1717
"require": {
1818
"php": "~8.2",
19-
"innmind/immutable": "~4.9|~5.0",
20-
"innmind/http": "~7.0",
21-
"innmind/validation": "~1.0"
19+
"innmind/foundation": "~1.3"
2220
},
2321
"autoload": {
2422
"psr-4": {

src/Manager/Native.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,11 @@
1212
use Innmind\Http\{
1313
ServerRequest,
1414
Header\Cookie,
15-
Header\CookieValue,
1615
};
1716
use Innmind\Validation\Is;
1817
use Innmind\Url\Path;
1918
use Innmind\Immutable\{
2019
Map,
21-
Sequence,
2220
Maybe,
2321
SideEffect,
2422
};
@@ -137,10 +135,9 @@ private function configureSessionId(ServerRequest $request): void
137135
}
138136

139137
$sessionName = \session_name();
140-
/** @var Sequence<CookieValue> */
141-
$values = Sequence::of(...$cookie->values()->toList());
142-
$_ = $values
143-
->flatMap(static fn($value) => $value->parameters()->values())
138+
$_ = $cookie
139+
->parameters()
140+
->values()
144141
->find(static fn($parameter) => $parameter->name() === $sessionName)
145142
->match(
146143
static fn($parameter) => \session_id($parameter->value()),

0 commit comments

Comments
 (0)