Alert and toast helpers
Use `success()`, `error()`, `question()`, `toast()`, and `input()` from `AlertManagerInterface`.
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.
The confirmation modal is created in PHP, rendered through the UX controller, and the result can be posted back to Symfony.
$alertManager->question(
title: 'Archive conversation?',
text: 'This cannot be undone.'
)->withCancelButton(); Why teams use it
The same alert model powers page loads, async fetch responses, Turbo stream rendering, HTMX triggers, and interactive Live Component callbacks.
Use `success()`, `error()`, `question()`, `toast()`, and `input()` from `AlertManagerInterface`.
Configure text, select, radio, file, range, and HTML input types without manual JS mapping.
Send modal results back to Symfony through callback URLs or Live Component actions.
Apply SweetAlert2 themes, button colors, custom classes, and input attributes from PHP.
#[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');
} Only administrators should continue.
Integration surface
UX SweetAlert does not ask you to choose one transport. It adapts to the response model already used by your application.
Turbo stream fragments are appended to HTML responses and injected from JSON fetch responses.
When Turbo is absent, the bundle emits `HX-Trigger` headers that dispatch alert payloads.
`ConfirmButton` and `InputModal` can resolve browser callbacks or invoke server-side actions.
The bundled controller fires lifecycle events before and after each modal and toast.
Ready to ship it
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.