Symfony UX SweetAlert2 Turbo + HTMX + Live Components

Sweet alerts for Symfony, without the frontend glue code.

UX SweetAlert lets you trigger polished modals, toasts, and input flows from PHP while the Stimulus controller handles Turbo streams, JSON callback flows, and Live Component events.

PHP-first

Trigger alerts and collect results from controllers and components.

No boilerplate

One Twig helper wires the Stimulus controller on the page.

Progressive

Works with plain requests, Turbo, HTMX, and Live Components.

Profile updated

Toast queued from the controller.

SweetAlert result flow
!

Archive this conversation?

The confirmation modal is created in PHP, rendered through the UX controller, and the result can be posted back to Symfony.

Controller snippet
$alertManager->question(
    title: 'Archive conversation?',
    text: 'This cannot be undone.'
)->withCancelButton();

Why teams use it

One bundle for every SweetAlert delivery path.

The same alert model powers page loads, async fetch responses, Turbo stream rendering, HTMX triggers, and interactive Live Component callbacks.

01

Alert and toast helpers

Use `success()`, `error()`, `question()`, `toast()`, and `input()` from `AlertManagerInterface`.

02

Input abstractions

Configure text, select, radio, file, range, and HTML input types without manual JS mapping.

03

Result-aware workflows

Send modal results back to Symfony through callback URLs or Live Component actions.

04

Theme-ready output

Apply SweetAlert2 themes, button colors, custom classes, and input attributes from PHP.

Server-side API
#[Route('/danger-zone', name: 'app_danger_zone')]
public function __invoke(AlertManagerInterface $alertManager): Response
{
    $alertManager->warning(
        title: 'Danger zone',
        text: 'Only administrators should continue.'
    )
        ->withCancelButton()
        ->denyOutsideClick();

    return $this->redirectToRoute('app_dashboard');
}
Rendered experience
!

Danger zone

Only administrators should continue.

Cancel Continue
`sweetalert:after-fire` emitted with the modal result

Integration surface

Built for the Symfony UX stack you already use.

UX SweetAlert does not ask you to choose one transport. It adapts to the response model already used by your application.

Turbo

Turbo stream fragments are appended to HTML responses and injected from JSON fetch responses.

HTMX

When Turbo is absent, the bundle emits `HX-Trigger` headers that dispatch alert payloads.

Live Components

`ConfirmButton` and `InputModal` can resolve browser callbacks or invoke server-side actions.

Stimulus

The bundled controller fires lifecycle events before and after each modal and toast.

Ready to ship it

Install the bundle, render one Twig helper, and start queuing alerts from PHP.

The docs below cover the delivery pipeline end-to-end, from the first `composer require` to callback URLs, flash conversion, and Live Component result handling.