Skip to content

Commit 2ff9055

Browse files
committed
refactor(router)!: move uri functions in their router namespace
1 parent 351bd42 commit 2ff9055

File tree

19 files changed

+26
-26
lines changed

19 files changed

+26
-26
lines changed

docs/1-essentials/01-routing.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ public function docsRedirect(string $path): Redirect
147147
Tempest provides a `\Tempest\uri` function that can be used to generate a URI to a controller method. This function accepts the FQCN of the controller or a callable to a method as its first argument, and named parameters as [the rest of its arguments](https://www.php.net/manual/en/functions.arguments.php#functions.variable-arg-list).
148148

149149
```php
150-
use function Tempest\uri;
150+
use function Tempest\Router\uri;
151151

152152
// Invokable classes can be referenced directly:
153153
uri(HomeController::class);
@@ -173,7 +173,7 @@ A signed URI may be used to ensure that the URI was not modified after it was cr
173173
To create a signed URI, you may use the `signed_uri` function. This function accepts the same arguments as `uri`, and returns the URI with a `signature` parameter:
174174

175175
```php
176-
use function Tempest\signed_uri;
176+
use function Tempest\Router\signed_uri;
177177

178178
signed_uri(
179179
action: [MailingListController::class, 'unsubscribe'],
@@ -184,7 +184,7 @@ signed_uri(
184184
Alternatively, you may use `temporary_signed_uri` to provide a duration after which the signed URI will expire, providing an extra layer of security.
185185

186186
```php
187-
use function Tempest\temporary_signed_uri;
187+
use function Tempest\Router\temporary_signed_uri;
188188

189189
temporary_signed_uri(
190190
action: PasswordlessAuthenticationController::class,
@@ -218,7 +218,7 @@ final class PasswordlessAuthenticationController
218218
To determine whether the current request matches a specific controller action, Tempest provides the `is_current_uri` function. This function accepts the same arguments as `uri`, and returns a boolean.
219219

220220
```php
221-
use function Tempest\is_current_uri;
221+
use function Tempest\Router\is_current_uri;
222222

223223
// Current URI is: /aircraft/1
224224

@@ -272,7 +272,7 @@ Once you have created a request class, you may simply inject it into a controlle
272272
use Tempest\Router\Post;
273273
use Tempest\Http\Responses\Redirect;
274274
use function Tempest\map;
275-
use function Tempest\uri;
275+
use function Tempest\Router\uri;
276276

277277
final readonly class AirportController
278278
{

docs/4-internals/03-view-spec.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ Tempest will merge all imports at the top of the compiled view, meaning that eac
103103
```html
104104
<?php
105105
use App\PostController;
106-
use function Tempest\uri;
106+
use function Tempest\Router\uri;
107107
?>
108108

109109
{{ uri([PostController::class, 'show'], post: $post->id) }}
@@ -608,7 +608,7 @@ Referencing a symbol within a view will automatically import it at the top of th
608608
```html
609609
<?php
610610
use App\PostController;
611-
use function Tempest\uri;
611+
use function Tempest\Router\uri;
612612
?>
613613

614614
{{ uri([PostController::class, 'show'], post: $post->id) }}

packages/router/src/Static/StaticGenerateCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@
3434
use Tempest\Vite\Exceptions\ManifestWasNotFound;
3535
use Throwable;
3636

37+
use function Tempest\Router\uri;
3738
use function Tempest\Support\path;
3839
use function Tempest\Support\str;
39-
use function Tempest\uri;
4040

4141
final class StaticGenerateCommand
4242
{

packages/router/src/functions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
declare(strict_types=1);
44

5-
namespace Tempest;
5+
namespace Tempest\Router;
66

77
use Tempest\DateTime\DateTime;
88
use Tempest\DateTime\Duration;

tests/Fixtures/Controllers/ValidationController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
use Tests\Tempest\Fixtures\Requests\BookRequest;
1515
use Tests\Tempest\Fixtures\Requests\ValidationRequest;
1616

17-
use function Tempest\uri;
17+
use function Tempest\Router\uri;
1818

1919
final readonly class ValidationController
2020
{

tests/Fixtures/Modules/Books/BookController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
use Tests\Tempest\Fixtures\Modules\Books\Requests\CreateBookRequest;
1515

1616
use function Tempest\map;
17-
use function Tempest\uri;
17+
use function Tempest\Router\uri;
1818

1919
final readonly class BookController
2020
{

tests/Fixtures/Modules/Form/form.view.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
use Tempest\View\GenericView;
44
use Tests\Tempest\Fixtures\Modules\Form\FormController;
55

6-
use function Tempest\uri;
6+
use function Tempest\Router\uri;
77

88
/** @var GenericView $this */
99

tests/Fixtures/Views/button-usage.view.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
use Tests\Tempest\Fixtures\Controllers\DocsController;
44

5-
use function Tempest\uri;
5+
use function Tempest\Router\uri;
66

77
?>
88

tests/Fixtures/Views/x-view-component-with-use-import.view.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
use Tests\Tempest\Fixtures\Modules\Home\HomeController;
44

5-
use function Tempest\uri;
5+
use function Tempest\Router\uri;
66

77
?>
88

tests/Fixtures/x-with-header.view.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
use Tests\Tempest\Fixtures\Modules\Home\HomeController;
44

5-
use function Tempest\uri;
5+
use function Tempest\Router\uri;
66

77
?>
88

0 commit comments

Comments
 (0)