@@ -3561,6 +3561,58 @@ Debugging Components
3561
3561
Need to list or debug some component issues.
3562
3562
The `Twig Component debug command `_ can help you.
3563
3563
3564
+
3565
+ Registering Live Components manually
3566
+ ------------------------------------
3567
+
3568
+ .. versionadded :: 2.17
3569
+
3570
+ The ``live.component `` tag has been introduced in LiveComponents 2.17.
3571
+
3572
+ Sometimes you might need to register your Live Components manually. This can be useful if you want to provide a live component
3573
+ along with a bundle. To do this, you can use the ``live.component `` tag:
3574
+
3575
+ .. configuration-block ::
3576
+
3577
+ .. code-block :: yaml
3578
+
3579
+ services :
3580
+ # ...
3581
+ app.component.product_search :
3582
+ class : App\Components\ProductSearch
3583
+ # ...
3584
+ tags :
3585
+ - { name: 'live.component', key: 'ProductSearch', template: 'product_search.html.twig' }
3586
+
3587
+ .. code-block :: xml
3588
+
3589
+ <?xml version =" 1.0" encoding =" UTF-8" ?>
3590
+ <container xmlns =" http://symfony.com/schema/dic/services"
3591
+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
3592
+ xmlns : framework =" http://symfony.com/schema/dic/symfony"
3593
+ xsi : schemaLocation =" http://symfony.com/schema/dic/services
3594
+ https://symfony.com/schema/dic/services/services-1.0.xsd
3595
+ http://symfony.com/schema/dic/symfony https://symfony.com/schema/dic/symfony/symfony-1.0.xsd" >
3596
+
3597
+ <service id =" app.component.product_search" class =" App\Components\ProductSearch" >
3598
+ <!-- ... -->
3599
+ <tag name =" live.component" key =" ProductSearch" template =" product_search.html.twig" />
3600
+ </service >
3601
+ </container >
3602
+
3603
+ .. code-block :: php
3604
+
3605
+ use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
3606
+
3607
+ return static function (ContainerConfigurator $container): void {
3608
+ $services = $container->services();
3609
+ $services
3610
+ ->set('app.component.product_search', App\Component\ProductSearch::class)
3611
+ ->tag('live.component', ['key' => 'product_search', 'template' => '@App/product_search.html.twig'])
3612
+ ;
3613
+ };
3614
+
3615
+
3564
3616
Test Helper
3565
3617
-----------
3566
3618
0 commit comments