v0.1.0 · Built for Laravel 12

SweetAlert2 for Laravel,
without the JavaScript.

Sudam Sweet Alert flashes beautiful modal alerts and toast notifications straight from your controllers. One line of PHP. Zero manual JS wiring. Built and maintained for Laravel 11 & 12.

Read the docs →

Try it live — this is the real output

Actively maintained

Built for Laravel 12 and PHP 8.2+, unlike older SweetAlert wrappers that have gone stale. Updated as Laravel evolves.

Zero JS required

Everything runs through Laravel's session flash. Call a PHP method, redirect, done. One Blade include and you're finished.

Fully customizable

Every SweetAlert2 option is available. Override colors, close buttons, positions and timers globally or per call.

01 · Get started

Installation

Four steps. Should take under two minutes on a fresh Laravel 12 app.

1

Require the package via Composer

$ composer require sudam-shrestha/sudam-sweet-alert
2

Publish the config file

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

Include the alert partial in your layout

Add this once, right before </body>:

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

Fire your first alert

use Sudam\SudamSweetAlert\Facades\SudamSweetAlert; SudamSweetAlert::success('Saved!', 'Your changes have been saved.'); return redirect()->back();
02 · API reference

Every method, with real output

Click "Try it" on any card below — these fire the actual package output, not a screenshot.

success()

Confirms an action completed. The most common alert — form saves, updates, deletions.

SudamSweetAlert::success('Saved!');
error()

Something failed. Validation errors, failed transactions, blocked actions.

SudamSweetAlert::error('Failed');
warning()

Flags risk before it happens. Irreversible actions, expiring sessions.

SudamSweetAlert::warning('Careful');
info()

Neutral, useful context. Announcements, tips, non-urgent updates.

SudamSweetAlert::info('Heads up');
question()

Asks before acting. Pair with a confirm/cancel flow for destructive actions.

SudamSweetAlert::question('Sure?');
toast()

Non-blocking corner notification. Top-right by default, auto-dismisses in 3s.

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

Chainable overrides

Every method returns $this, so you can chain adjustments inline.

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

Available config keys

Set once in config/sudam-sweet-alert.php, override per call whenever you need to.

Key Default Controls
position 'center' Default position for modal alerts
timer null Auto-close delay (ms) for modals
show_confirm_button true Show OK button on modals
toast_position 'top-end' Default toast corner
toast_timer 3000 Toast auto-dismiss delay (ms)
show_close_button true Show × button on all alerts
confirm_button_color '#3085d6' OK button color
cancel_button_color '#d33' Cancel button color
background null Popup background color
cdn jsdelivr v11 SweetAlert2 script source
04 · FAQ

Frequently asked questions

What is Sudam Sweet Alert?

It's a Laravel package that wraps SweetAlert2, letting you fire modal alerts and toast notifications directly from controllers using session flash data — no JavaScript wiring needed.

Does it work with Laravel 12?

Yes — built and tested against Laravel 11 and 12, on PHP 8.2 and above.

Is it free?

Yes, fully open source under the MIT license — free for personal and commercial projects.

How is this different from realrashid/sweet-alert?

Same core idea, actively maintained for current Laravel versions, with built-in toast support, close-button and color theming out of the box.

Ready to swap it in?

One Composer command. Two minutes. No more dead SweetAlert wrappers.

View on Packagist →