How to build a Symfony Live Component with Claude
何时使用: You need a reactive form, filter, or list that updates on the server without a full page reload.
前置条件
- Symfony 6.4+ project with symfony/ux-live-component installed — composer require symfony/ux-live-component
- Skill cloned into ~/.claude/skills/ — git clone https://github.com/smnandre/symfony-ux-skills ~/.claude/skills/symfony-ux-skills
步骤
-
Describe the component you needBuild a Live Component for a product search filter with checkboxes for categories and a text query — updates results live as the user types.✓ 已复制→ Claude references LiveProp, LiveAction, debounce modifiers from the skill
-
Let Claude scaffold the PHP + TwigGenerate the PHP component class and the Twig template. Use attributes, not annotations.✓ 已复制→ File output follows Symfony UX naming (
src/Twig/Components/...) -
Ask Claude to wire the parent pageShow me how to embed this component in an existing Twig page and pass initial state.✓ 已复制→ Uses
{{ component() }}helper correctly
结果: A working Live Component with proper LiveProp typing and no custom JS.
注意事项
- Claude mixes Live Component and Twig Component concepts — Re-ask naming the package explicitly: 'use symfony/ux-live-component, not twig-component'