PHPackages                             sudam-shrestha/sudam-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. sudam-shrestha/sudam-sweet-alert

ActiveLibrary

sudam-shrestha/sudam-sweet-alert
================================

This is my package sudam-sweet-alert

v0.1.1(1mo ago)031MITPHPPHP ^8.2

Since Jul 14Pushed 1mo agoCompare

[ Source](https://github.com/sudam-shrestha/sudam-sweet-alert)[ Packagist](https://packagist.org/packages/sudam-shrestha/sudam-sweet-alert)[ Docs](https://github.com/sudam-shrestha/sudam-sweet-alert)[ RSS](/packages/sudam-shrestha-sudam-sweet-alert/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependencies (12)Versions (2)Used By (0)

Sudam Sweet Alert
=================

[](#sudam-sweet-alert)

[![Latest Version on Packagist](https://camo.githubusercontent.com/129b38efc2e6cc38cbab4501094f83ba1b396a818f2cd70d9ddccc4b77806a84/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f737564616d2d73687265737468612f737564616d2d73776565742d616c6572742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/sudam-shrestha/sudam-sweet-alert)[![GitHub Tests Action Status](https://github.com/sudam-shrestha/sudam-sweet-alert/actions/workflows/run-tests.yml/badge.svg)](https://github.com/sudam-shrestha/sudam-sweet-alert/actions?query=workflow%3Arun-tests+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/1a61d9f28b6eca6bccb7386d080644953327d1af04de23a21c78e174843aee23/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f737564616d2d73687265737468612f737564616d2d73776565742d616c6572742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/sudam-shrestha/sudam-sweet-alert)

A modern, actively maintained [SweetAlert2](https://sweetalert2.github.io/) wrapper for Laravel 12. Fire beautiful modal alerts and toasts straight from your controllers using session flash data — no manual JS wiring required.

Built as a fresh alternative to older SweetAlert packages that are no longer maintained.

Features
--------

[](#features)

- Simple, chainable API: `success()`, `error()`, `warning()`, `info()`, `question()`, `toast()`
- Built-in toast notifications with sensible defaults (top-right, auto-dismiss)
- Configurable close button, colors, background, and animation on every alert
- Per-call option overrides — any SweetAlert2 option can be passed through
- Zero database/migrations required — pure session flash, works out of the box

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

[](#installation)

You can install the package via composer:

```
composer require sudam-shrestha/sudam-sweet-alert
```

Publish the config file with:

```
php artisan vendor:publish --tag="sudam-sweet-alert-config"
```

This is the contents of the published config file:

```
return [
    // Modal alert defaults
    'position' => 'center',
    'timer' => null,
    'show_confirm_button' => true,

    // Toast defaults
    'toast_position' => 'top-end',
    'toast_timer' => 3000,

    // Design — applies to both modals and toasts
    'show_close_button' => true,
    'confirm_button_color' => '#3085d6',
    'cancel_button_color' => '#d33',
    'background' => null,
    'text_color' => null,
    'buttons_styling' => true,
    'custom_class' => [],

    'cdn' => 'https://cdn.jsdelivr.net/npm/sweetalert2@11',
];
```

Optionally, publish the views to customize the alert markup:

```
php artisan vendor:publish --tag="sudam-sweet-alert-views"
```

Finally, add this once to your main layout, right before ``:

```
@include('sudam-sweet-alert::alert')
```

Usage
-----

[](#usage)

Import the facade:

```
use Sudam\SudamSweetAlert\Facades\SudamSweetAlert;
```

### Modal alerts

[](#modal-alerts)

```
SudamSweetAlert::success('Saved!', 'Your changes have been saved.');
SudamSweetAlert::error('Failed', 'Something went wrong.');
SudamSweetAlert::warning('Careful', 'This action cannot be undone.');
SudamSweetAlert::info('Heads up', 'Here is something you should know.');
SudamSweetAlert::question('Are you sure?', 'This will delete the record.');

return redirect()->back();
```

### Toast notifications

[](#toast-notifications)

```
SudamSweetAlert::toast('success', 'Saved successfully!');
```

By default, toasts appear top-right and auto-dismiss after 3 seconds.

### Overriding options per call

[](#overriding-options-per-call)

Any [SweetAlert2 option](https://sweetalert2.github.io/#configuration) can be passed as the last argument:

```
SudamSweetAlert::error('Failed', 'Could not save record.', [
    'position' => 'bottom-start',
    'timer' => 5000,
    'showCloseButton' => false,
]);
```

### Chainable helpers

[](#chainable-helpers)

```
SudamSweetAlert::success('Saved!')
    ->timer(4000)
    ->position('top-end')
    ->showCloseButton(false);
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Sudam Shrestha](https://github.com/sudam-shrestha)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance90

Actively maintained with recent releases

Popularity10

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity36

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

48d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e06ed1fab26c047888ea5743e96974013ee1536491407b84c7559a95b8b3afc3?d=identicon)[sudam-shrestha](/maintainers/sudam-shrestha)

---

Top Contributors

[![sudam-shrestha](https://avatars.githubusercontent.com/u/117344519?v=4)](https://github.com/sudam-shrestha "sudam-shrestha (4 commits)")

---

Tags

laravelSudamsudam-sweet-alert

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/sudam-shrestha-sudam-sweet-alert/health.svg)

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

###  Alternatives

[dedoc/scramble

Automatic generation of API documentation for Laravel applications.

2.2k14.2M149](/packages/dedoc-scramble)[spatie/laravel-pdf

Create PDFs in Laravel apps

1.0k6.1M53](/packages/spatie-laravel-pdf)[codewithdennis/filament-select-tree

The multi-level select field enables you to make single selections from a predefined list of options that are organized into multiple levels or depths.

331634.0k37](/packages/codewithdennis-filament-select-tree)[harris21/laravel-fuse

Circuit breaker for Laravel queue jobs. Protect your workers from cascading failures.

24795.1k](/packages/harris21-laravel-fuse)[vormkracht10/laravel-mails

Laravel Mails can collect everything you might want to track about the mails that has been sent by your Laravel app.

25263.1k](/packages/vormkracht10-laravel-mails)[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3915.5k](/packages/rawilk-profile-filament-plugin)

PHPackages © 2026

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