Skip to content

Commit ed9a222

Browse files
committed
Update docs
1 parent f226317 commit ed9a222

File tree

14 files changed

+90
-90
lines changed

14 files changed

+90
-90
lines changed

composer.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Web/Blog/articles/2024-11-25-alpha-4.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -149,14 +149,14 @@ As a comparison, this is what you had to write before:
149149

150150
```php
151151
use Tempest\Router\HttpMiddleware;
152-
use Tempest\Router\Request;
153-
use Tempest\Router\Response;
152+
use Tempest\Http\Request;
153+
use Tempest\Http\Response;
154154

155155
class MyMiddleware implements HttpMiddleware
156156
{
157157
public function __invoke(Request $request, callable $next): Response
158158
{
159-
/** @var \Tempest\Router\Response $response */
159+
/** @var \Tempest\Http\Response $response */
160160
$response = $next($request);
161161

162162
// …
@@ -168,8 +168,8 @@ And now you can write this:
168168

169169
```php
170170
use Tempest\Router\HttpMiddleware;
171-
use Tempest\Router\Request;
172-
use Tempest\Router\Response;
171+
use Tempest\Http\Request;
172+
use Tempest\Http\Response;
173173
use Tempest\Router\HttpMiddlewareCallable;
174174

175175
class MyMiddleware implements HttpMiddleware

src/Web/Blog/articles/2025-03-13-request-objects-in-tempest.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ It doesn't get much simpler than this, right? We have an object representing the
2929
Here's what that looks like in practice:
3030

3131
```php
32-
use Tempest\Router\Request;
32+
use Tempest\Http\Request;
3333
use function Tempest\map;
3434

3535
final readonly class BookController
@@ -117,8 +117,8 @@ With validation out of the way, let's take a look at other approaches of mapping
117117
Here's what our `BookRequest` looks like:
118118

119119
```php
120-
use Tempest\Router\IsRequest;
121-
use Tempest\Router\Request;
120+
use Tempest\Http\IsRequest;
121+
use Tempest\Http\Request;
122122

123123
final class BookRequest implements Request
124124
{

src/Web/Blog/articles/2025-03-30-about-route-attributes.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Routing in Tempest is done with route attributes: each controller action can hav
1111
use Tempest\Router\Get;
1212
use Tempest\Router\Post;
1313
use Tempest\Router\Delete;
14-
use Tempest\Router\Response;
14+
use Tempest\Http\Response;
1515

1616
final class BookAdminController
1717
{
@@ -99,7 +99,7 @@ And then you simply use that attribute for admin routes:
9999

100100
```php
101101
use Tempest\Http\Method;
102-
use Tempest\Router\Response;
102+
use Tempest\Http\Response;
103103

104104
final class BookAdminController
105105
{

src/Web/Documentation/content/1.x/0-getting-started/02-installation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ As an example, Tempest is able to determine which methods are controller methods
104104

105105
```php app/BlogPostController.php
106106
use Tempest\Router\Get;
107-
use Tempest\Router\Response;
107+
use Tempest\Http\Response;
108108
use Tempest\View\View;
109109

110110
final readonly class BlogPostController

src/Web/Documentation/content/1.x/1-essentials/01-routing.md

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ In controller actions, you may want to receive an object instead of a scalar val
7676

7777
```php app/AircraftController.php
7878
use Tempest\Router\Get;
79-
use Tempest\Router\Response;
79+
use Tempest\Http\Response;
8080
use App\Aircraft;
8181

8282
final class AircraftController
@@ -109,7 +109,7 @@ You may inject string-backed enumerations to controller actions. Tempest will tr
109109

110110
```php app/AircraftController.php
111111
use Tempest\Router\Get;
112-
use Tempest\Router\Response;
112+
use Tempest\Http\Response;
113113
use App\AircraftType;
114114

115115
final readonly class AircraftController
@@ -175,19 +175,19 @@ is_current_uri(AircraftController::class, id: 2); // false
175175

176176
## Accessing request data
177177

178-
A core pattern of any web application is to access data from the current request. You may do so by injecting {`Tempest\Router\Request`} to a controller action. This class provides access to the request's body, query parameters, method, and other attributes through dedicated class properties.
178+
A core pattern of any web application is to access data from the current request. You may do so by injecting {`Tempest\Http\Request`} to a controller action. This class provides access to the request's body, query parameters, method, and other attributes through dedicated class properties.
179179

180180
### Using request classes
181181

182182
In most situations, the data you expect to receive from a request is structured. You expect clients to send specific values, and you want them to follow specific rules.
183183

184184
The idiomatic way to achieve this is by using request classes. They are classes with public properties that correspond to the data you want to retrieve from the request. Tempest will automatically validate these properties using PHP's type system, in addition to optional [validation attributes](../2-features/06-validation) if needed.
185185

186-
A request class must implement {`Tempest\Router\Request`} and should use the {`Tempest\Router\IsRequest`} trait, which provides the default implementation.
186+
A request class must implement {`Tempest\Http\Request`} and should use the {`Tempest\Http\IsRequest`} trait, which provides the default implementation.
187187

188188
```php app/RegisterAirportRequest.php
189-
use Tempest\Router\Request;
190-
use Tempest\Router\IsRequest;
189+
use Tempest\Http\Request;
190+
use Tempest\Http\IsRequest;
191191
use Tempest\Validation\Rules\Length;
192192

193193
final class RegisterAirportRequest implements Request
@@ -211,7 +211,7 @@ Once you have created a request class, you may simply inject it into a controlle
211211

212212
```php app/AirportController.php
213213
use Tempest\Router\Post;
214-
use Tempest\Router\Responses\Redirect;
214+
use Tempest\Http\Responses\Redirect;
215215
use function Tempest\map;
216216
use function Tempest\uri;
217217

@@ -237,7 +237,7 @@ For simpler use cases, you may simply retrieve a value from the body or the quer
237237

238238
```php app/AircraftController.php
239239
use Tempest\Router\Get;
240-
use Tempest\Router\Request;
240+
use Tempest\Http\Request;
241241

242242
final readonly class AircraftController
243243
{
@@ -256,7 +256,7 @@ Middleware can be applied to handle tasks in between receiving a request and sen
256256

257257
```php app/ReceiveInteractionController.php
258258
use Tempest\Router\Get;
259-
use Tempest\Router\Response;
259+
use Tempest\Http\Response;
260260

261261
final readonly class ReceiveInteractionController
262262
{
@@ -275,8 +275,8 @@ The middleware class must be an invokable class that implements the {`Tempest\Ro
275275
```php
276276
use Tempest\Router\HttpMiddleware;
277277
use Tempest\Router\HttpMiddlewareCallable;
278-
use Tempest\Router\Request;
279-
use Tempest\Router\Response;
278+
use Tempest\Http\Request;
279+
use Tempest\Http\Response;
280280
use Tempest\Discovery\SkipDiscovery;
281281
use Tempest\Core\Priority;
282282

@@ -352,7 +352,7 @@ Tempest has a powerful templating system inspired by modern front-end frameworks
352352

353353
### Using built-in response classes
354354

355-
Tempest provides several classes, all implementing the {`Tempest\Router\Response`} interface, mostly named after HTTP statuses.
355+
Tempest provides several classes, all implementing the {`Tempest\Http\Response`} interface, mostly named after HTTP statuses.
356356

357357
- `{php}Ok` — the 200 response. Accepts an optional body.
358358
- `{php}Created` — the 201 response. Accepts an optional body.
@@ -368,9 +368,9 @@ The following example conditionnally returns a `Redirect`, otherwise letting the
368368

369369
```php app/FlightPlanController.php
370370
use Tempest\Router\Get;
371-
use Tempest\Router\Responses\Download;
372-
use Tempest\Router\Responses\Redirect;
373-
use Tempest\Router\Response;
371+
use Tempest\Http\Responses\Download;
372+
use Tempest\Http\Responses\Redirect;
373+
use Tempest\Http\Response;
374374

375375
final readonly class FlightPlanController
376376
{
@@ -392,14 +392,14 @@ final readonly class FlightPlanController
392392

393393
It might happen that you need to dynamically compute the response's status code, and would rather not use a condition to send the corresponding response object.
394394

395-
You may then return an instance of {`Tempest\Router\GenericResponse`}, specifying the status code and an optional body.
395+
You may then return an instance of {`Tempest\Http\GenericResponse`}, specifying the status code and an optional body.
396396

397397
```php app/CreateFlightController.php
398398
use Tempest\Router\Get;
399-
use Tempest\Router\Responses\Download;
400-
use Tempest\Router\Responses\Redirect;
401-
use Tempest\Router\GenericResponse;
402-
use Tempest\Router\Response;
399+
use Tempest\Http\Responses\Download;
400+
use Tempest\Http\Responses\Redirect;
401+
use Tempest\Http\GenericResponse;
402+
use Tempest\Http\Response;
403403

404404
final readonly class CreateFlightController
405405
{
@@ -421,12 +421,12 @@ final readonly class CreateFlightController
421421

422422
There are situations where you might send the same kind of response in a lot of places, or you might want to have a proper API for sending a structured response.
423423

424-
You may create your own response class by implementing {`Tempest\Router\Response`}, which default implementation is provided by the {`Tempest\Router\IsResponse`} trait:
424+
You may create your own response class by implementing {`Tempest\Http\Response`}, which default implementation is provided by the {`Tempest\Http\IsResponse`} trait:
425425

426426
```php app/AircraftRegistered.php
427-
use Tempest\Router\IsResponse;
428-
use Tempest\Router\Response;
429-
use Tempest\Router\Status;
427+
use Tempest\Http\IsResponse;
428+
use Tempest\Http\Response;
429+
use Tempest\Http\Status;
430430

431431
final class AircraftRegistered implements Response
432432
{
@@ -452,8 +452,8 @@ However, you may override the content type manually by specifying the `setConten
452452
```php app/JsonController.php
453453
use Tempest\Router\Get;
454454
use Tempest\Router\ContentType;
455-
use Tempest\Router\Response;
456-
use Tempest\Router\Responses\Ok;
455+
use Tempest\Http\Response;
456+
use Tempest\Http\Responses\Ok;
457457

458458
final readonly class JsonController
459459
{
@@ -530,8 +530,8 @@ Tempest provides a way to perform that task after the response has been sent, so
530530
```php app/TrackVisitMiddleware.php
531531
use Tempest\Router\HttpMiddleware;
532532
use Tempest\Router\HttpMiddlewareCallable;
533-
use Tempest\Router\Request;
534-
use Tempest\Router\Response;
533+
use Tempest\Http\Request;
534+
use Tempest\Http\Response;
535535

536536
use function Tempest\defer;
537537
use function Tempest\event;

src/Web/Documentation/content/1.x/1-essentials/05-container.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ Let's take use the concept of route model binding as an example. A controller mi
125125

126126
```php app/BookController.php
127127
use Tempest\Router\Get;
128-
use Tempest\Router\Response;
128+
use Tempest\Http\Response;
129129

130130
final readonly class BookController
131131
{

src/Web/Documentation/content/1.x/2-features/02-asset-bundling.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,8 @@ use Tempest\Core\KernelEvent;
134134
use Tempest\EventBus\EventHandler;
135135
use Tempest\Router\HttpMiddleware;
136136
use Tempest\Router\HttpMiddlewareCallable;
137-
use Tempest\Router\Request;
138-
use Tempest\Router\Response;
137+
use Tempest\Http\Request;
138+
use Tempest\Http\Response;
139139
use Tempest\Router\Router;
140140
use Tempest\Support\Random;
141141
use Tempest\Vite\ViteConfig;

src/Web/Documentation/content/1.x/2-features/04-authentication.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ Logging in a user can be done with the `Authenticator` class:
1919
// app/AuthController.php
2020

2121
use Tempest\Auth\Authenticator;
22-
use Tempest\Router\Request;
23-
use Tempest\Router\Response;
24-
use Tempest\Router\Responses\Redirect;
22+
use Tempest\Http\Request;
23+
use Tempest\Http\Response;
24+
use Tempest\Http\Responses\Redirect;
2525

2626
final readonly class AuthController
2727
{
@@ -51,7 +51,7 @@ You can protect controller routes using the `#[Allow]` attribute:
5151
// app/AdminController.php
5252

5353
use Tempest\Auth\Allow;
54-
use Tempest\Router\Response;
54+
use Tempest\Http\Response;
5555

5656
final readonly class AdminController
5757
{
@@ -69,7 +69,7 @@ Tempest uses a permission-based authorizer. That means that, in order for users
6969
// app/AdminController.php
7070

7171
use Tempest\Auth\Allow;
72-
use Tempest\Router\Response;
72+
use Tempest\Http\Response;
7373

7474
final readonly class AdminController
7575
{

src/Web/Documentation/content/main/0-getting-started/02-installation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ As an example, Tempest is able to determine which methods are controller methods
104104

105105
```php app/BlogPostController.php
106106
use Tempest\Router\Get;
107-
use Tempest\Router\Response;
107+
use Tempest\Http\Response;
108108
use Tempest\View\View;
109109

110110
final readonly class BlogPostController

0 commit comments

Comments
 (0)