PHPackages                             pentiminax/ux-sweet-alert - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. pentiminax/ux-sweet-alert

ActiveSymfony-bundle[Utility &amp; Helpers](/categories/utility)

pentiminax/ux-sweet-alert
=========================

SweetAlert2 integration for Symfony

v0.21.0(2mo ago)286.4k↓12%2[1 PRs](https://github.com/pentiminax/ux-sweet-alert/pulls)MITPHPPHP &gt;=8.3CI passing

Since Jul 3Pushed 1w ago2 watchersCompare

[ Source](https://github.com/pentiminax/ux-sweet-alert)[ Packagist](https://packagist.org/packages/pentiminax/ux-sweet-alert)[ Docs](https://github.com/pentiminax/ux-sweet-alert)[ RSS](/packages/pentiminax-ux-sweet-alert/feed)WikiDiscussions main Synced 2d ago

READMEChangelog (10)Dependencies (29)Versions (48)Used By (0)

UX SweetAlert
=============

[](#ux-sweetalert)

[![Latest Stable Version](https://camo.githubusercontent.com/09656bfad2f7ab29d881169b62f69fe99d3e29a8ab10d22bf3907a16448baf7b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f70656e74696d696e61782f75782d73776565742d616c6572742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/pentiminax/ux-sweet-alert)[![PHP Version](https://camo.githubusercontent.com/b391ad2dbd8f613caebe54b1151f9adb11602c92ac81f8dad6c9f219ac7f2f88/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f70656e74696d696e61782f75782d73776565742d616c6572743f7374796c653d666c61742d737175617265)](https://packagist.org/packages/pentiminax/ux-sweet-alert)[![Downloads total](https://camo.githubusercontent.com/a2d81ba812bcafb25e34d0f9cdcbe97b34df83512bb88071d9fcb0a09a6dd627/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f70656e74696d696e61782f75782d73776565742d616c6572742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/pentiminax/ux-sweet-alert/stats)[![Coverage](https://camo.githubusercontent.com/43a7a9d07c491155d8bde79e128b6ca2d488b331415b4da29f969462175b9ef6/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f70656e74696d696e61782f75782d73776565742d616c6572743f7374796c653d666c61742d737175617265)](https://codecov.io/gh/pentiminax/ux-sweet-alert)

UX SweetAlert is a Symfony bundle that integrates the SweetAlert2 library into your Symfony applications. It provides PHP helpers, input-type abstractions, Live Components, and a Stimulus controller to display alerts, input dialogs, and toast notifications.

Requirements
------------

[](#requirements)

- PHP 8.3 or higher
- Symfony StimulusBundle
- Composer

Installation
------------

[](#installation)

Install the library via Composer:

```
composer require pentiminax/ux-sweet-alert
```

Basic usage
-----------

[](#basic-usage)

To automatically display toasts and alerts in your templates, add the following Twig function in your base.html.twig (or the layout file):

```
{{ ux_sweet_alert_scripts() }}
```

Alerts
------

[](#alerts)

Inject the AlertManagerInterface and use the helper methods to create alerts:

```
use Pentiminax\UX\SweetAlert\AlertManagerInterface;

#[Route('/', name: 'app_homepage')]
public function index(AlertManagerInterface $alertManager): Response
{
    $alertManager->success(
        title: 'Update Successful',
        text: 'Your settings have been saved.'
    );

    return $this->redirectToRoute('dashboard');
}
```

Toasts
------

[](#toasts)

Use the `AlertManagerInterface` service with the `toast()` method to create toast notifications:

```
use Pentiminax\UX\SweetAlert\AlertManagerInterface;
use Pentiminax\UX\SweetAlert\Enum\Position;

class HomeController extends AbstractController
{
    #[Route('/', name: 'app_homepage')]
    public function index(AlertManagerInterface $alertManager): Response
    {
       $alertManager->toast(
            title: 'title',
            text: 'text',
            position: Position::TOP_END,
            timer: 3000,
            timerProgressBar: true
        );

        return $this->render('home/index.html.twig');
    }
}
```

Input dialogs
-------------

[](#input-dialogs)

Use `AlertManagerInterface::input()` with one of the provided input type classes when you want to collect user input from PHP:

```
use Pentiminax\UX\SweetAlert\AlertManagerInterface;
use Pentiminax\UX\SweetAlert\InputType\Text;

#[Route('/profile', name: 'app_profile')]
public function index(AlertManagerInterface $alertManager): Response
{
    $alertManager->input(
        inputType: new Text(
            label: 'Display name',
            value: 'Tanguy',
            placeholder: 'Enter your display name',
        ),
        title: 'Update profile',
        text: 'This change is visible to other users.'
    );

    return $this->render('profile/index.html.twig');
}
```

Available helpers include `Text`, `Textarea`, `Select`, `Radio`, `Checkbox`, `File`, `Range`, and `HtmlInputType` for other native HTML input types.

Live Components
---------------

[](#live-components)

The bundle also ships `SweetAlert:ConfirmButton` and `SweetAlert:InputModal` Live Components. Render `{{ ux_sweet_alert_scripts() }}` on the page, then use the component that matches your interaction pattern. See the online documentation for full examples.

Documentation
-------------

[](#documentation)

- [Online documentation](https://pentiminax.github.io/ux-sweet-alert/)

###  Health Score

52

—

FairBetter than 96% of packages

Maintenance92

Actively maintained with recent releases

Popularity35

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 62% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~7 days

Total

42

Last Release

80d ago

PHP version history (2 changes)v0.1.0PHP &gt;=8.2

v0.18.0PHP &gt;=8.3

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/4866668?v=4)[pentiminax](/maintainers/Pentiminax)[@pentiminax](https://github.com/pentiminax)

---

Top Contributors

[![pentiminax](https://avatars.githubusercontent.com/u/4866668?v=4)](https://github.com/pentiminax "pentiminax (142 commits)")[![tlemarie](https://avatars.githubusercontent.com/u/146178261?v=4)](https://github.com/tlemarie "tlemarie (75 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (10 commits)")[![clementtalleu](https://avatars.githubusercontent.com/u/11056924?v=4)](https://github.com/clementtalleu "clementtalleu (1 commits)")[![daviddprtma](https://avatars.githubusercontent.com/u/76859181?v=4)](https://github.com/daviddprtma "daviddprtma (1 commits)")

---

Tags

javascriptsweetalert2symfony-bundlesymfony-uxuxsymfony-uxsweet-alert

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/pentiminax-ux-sweet-alert/health.svg)

```
[![Health](https://phpackages.com/badges/pentiminax-ux-sweet-alert/health.svg)](https://phpackages.com/packages/pentiminax-ux-sweet-alert)
```

###  Alternatives

[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k17.9M388](/packages/easycorp-easyadmin-bundle)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.5k5.9M738](/packages/sylius-sylius)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
