@@ -11,8 +11,8 @@ to familiarize yourself in the `TwigComponent documentation`_.
1111
1212A real-time product search component might look like this::
1313
14- // src/Components/ProductSearch.php
15- namespace App\Components;
14+ // src/Twig/ Components/ProductSearch.php
15+ namespace App\Twig\ Components;
1616
1717 use Symfony\UX\LiveComponent\Attribute\AsLiveComponent;
1818 use Symfony\UX\LiveComponent\Attribute\LiveProp;
@@ -113,8 +113,8 @@ documentation to get the basics of Twig components.
113113
114114Suppose you've already built a basic Twig component::
115115
116- // src/Components/RandomNumber.php
117- namespace App\Components;
116+ // src/Twig/ Components/RandomNumber.php
117+ namespace App\Twig\ Components;
118118
119119 use Symfony\UX\TwigComponent\Attribute\AsTwigComponent;
120120
@@ -141,7 +141,7 @@ re-rendered live on the frontend), replace the component's
141141
142142.. code-block :: diff
143143
144- // src/Components/RandomNumber.php
144+ // src/Twig/ Components/RandomNumber.php
145145 - use Symfony\UX\TwigComponent\Attribute\AsTwigComponent;
146146 + use Symfony\UX\LiveComponent\Attribute\AsLiveComponent;
147147 + use Symfony\UX\LiveComponent\DefaultActionTrait;
@@ -194,8 +194,8 @@ LiveProps: Stateful Component Properties
194194
195195Let's make our component more flexible by adding a ``$max `` property::
196196
197- // src/Components/RandomNumber.php
198- namespace App\Components;
197+ // src/Twig/ Components/RandomNumber.php
198+ namespace App\Twig\ Components;
199199
200200 // ...
201201 use Symfony\UX\LiveComponent\Attribute\LiveProp;
@@ -294,7 +294,7 @@ Well, actually, we're missing one step. By default, a ``LiveProp`` is
294294
295295.. code-block :: diff
296296
297- // src/Components/RandomNumber.php
297+ // src/Twig/ Components/RandomNumber.php
298298 // ...
299299
300300 class RandomNumber
@@ -1051,8 +1051,8 @@ that, when clicked, sets the min/max numbers back to a default value.
10511051First, add a method with a ``LiveAction `` attribute above it that does
10521052the work::
10531053
1054- // src/Components/RandomNumber.php
1055- namespace App\Components;
1054+ // src/Twig/ Components/RandomNumber.php
1055+ namespace App\Twig\ Components;
10561056
10571057 // ...
10581058 use Symfony\UX\LiveComponent\Attribute\LiveAction;
@@ -1115,8 +1115,8 @@ normal controller method that you would create with a route.
11151115
11161116This means that, for example, you can use action autowiring::
11171117
1118- // src/Components/RandomNumber.php
1119- namespace App\Components;
1118+ // src/Twig/ Components/RandomNumber.php
1119+ namespace App\Twig\ Components;
11201120
11211121 // ...
11221122 use Psr\Log\LoggerInterface;
@@ -1162,8 +1162,8 @@ You can also pass arguments to your action by adding each as a
11621162In your component, to allow each argument to be passed, add
11631163the ``#[LiveArg()] `` attribute::
11641164
1165- // src/Components/ItemList.php
1166- namespace App\Components;
1165+ // src/Twig/ Components/ItemList.php
1166+ namespace App\Twig\ Components;
11671167
11681168 // ...
11691169 use Psr\Log\LoggerInterface;
@@ -1215,8 +1215,8 @@ Sometimes, you may want to redirect after an action is executed
12151215page). You can do that by returning a ``RedirectResponse `` from your
12161216action::
12171217
1218- // src/Components/RandomNumber.php
1219- namespace App\Components;
1218+ // src/Twig/ Components/RandomNumber.php
1219+ namespace App\Twig\ Components;
12201220
12211221 // ...
12221222 use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
@@ -1284,8 +1284,8 @@ You can also specify a modifier parameter to choose which files should be upload
12841284
12851285The files will be available in a regular ``$request->files `` files bag::
12861286
1287- // src/Components/FileUpload.php
1288- namespace App\Components;
1287+ // src/Twig/ Components/FileUpload.php
1288+ namespace App\Twig\ Components;
12891289
12901290 use Symfony\Component\HttpFoundation\Request;
12911291 use Symfony\UX\LiveComponent\Attribute\AsLiveComponent;
@@ -2474,8 +2474,8 @@ Changing the URL when a LiveProp changes
24742474
24752475If you want the URL to update when a ``LiveProp `` changes, you can do that with the ``url `` option::
24762476
2477- // src/Components/SearchModule.php
2478- namespace App\Components;
2477+ // src/Twig/ Components/SearchModule.php
2478+ namespace App\Twig\ Components;
24792479
24802480 use Symfony\UX\LiveComponent\Attribute\AsLiveComponent;
24812481 use Symfony\UX\LiveComponent\Attribute\LiveProp;
@@ -3488,7 +3488,7 @@ Then specify this new route on your component:
34883488
34893489.. code-block :: diff
34903490
3491- // src/Components/RandomNumber.php
3491+ // src/Twig/ Components/RandomNumber.php
34923492 use Symfony\UX\LiveComponent\Attribute\AsLiveComponent;
34933493 use Symfony\UX\LiveComponent\DefaultActionTrait;
34943494
@@ -3507,7 +3507,7 @@ You can also control the type of the generated URL:
35073507
35083508.. code-block :: diff
35093509
3510- // src/Components/RandomNumber.php
3510+ // src/Twig/ Components/RandomNumber.php
35113511 + use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
35123512 use Symfony\UX\LiveComponent\Attribute\AsLiveComponent;
35133513 use Symfony\UX\LiveComponent\DefaultActionTrait;
0 commit comments