Introduction
UX SweetAlert is a Symfony bundle that wraps SweetAlert2 in a PHP-first API. You queue alerts, toasts, and input dialogs from Symfony code, then the bundled Stimulus controller renders them at the right time on the client.
What it gives you
AlertManagerInterfacehelpers for success, error, warning, info, question, toast, and input flows.- A Twig helper,
ux_sweet_alert_scripts(), that mounts the frontend controller with queued alerts. - Input abstractions such as
Text,Textarea,Select,Radio,Checkbox,File, andRange. - Result-aware flows through callback URLs and the
ResultValueResolver. - Live Component helpers for confirmation and input modals.
- Automatic transport for Turbo streams and an HTMX fallback via
HX-Trigger.
How the delivery pipeline works
- Your controller, service, or Live Component creates an alert through
AlertManagerInterface. - The bundle stores the alert in session storage and mirrors it in the request context.
ux_sweet_alert_scripts()renders a Stimulus controller payload for page-based flows.- The controller calls
Swal.fire(...), emits lifecycle browser events, and optionally posts a result back to Symfony.
What gets documented here
- Getting started with installation and the first rendered alert.
- Core usage patterns for alerts, toasts, and input dialogs.
- Transport-specific behavior for Turbo, HTMX, and Live Components.
- API reference pages for the alert model, enums, input types, and callback results.