realrashid/sweet-alert
| Install | |
|---|---|
composer require realrashid/sweet-alert |
|
| Latest Version: | v8.0.0 |
| PHP: | ^8.3 |
| Laravel: | 11 · 12 · 13 |
| Older releases: | 5 – 10 |
| License: | MIT |
| Last Updated: | Oct 16, 2026 |
| Links: | GitHub · Packagist |
Laravel SweetAlert
A beautiful, responsive, customizable, accessible (WAI-ARIA) replacement for JavaScript popup boxes for Laravel — rebuilt from scratch with a fluent, Laravel-native API.
Features
- Fluent Builder API — Chain methods naturally like Laravel Eloquent
- Full SweetAlert2 Coverage — Inputs, deny buttons, pre-confirm, animations, themes, and more
- Three Purpose-Built Builders —
AlertBuilder,ToastBuilder, andInputBuilder - PHP 8.3+ Enums — Type-safe
AlertType,InputType, andPositionenums with IDE autocompletion - Livewire v4 Support — First-class
SweetAlertTraitfor dispatching alerts as browser events - Inertia.js Support — Share alerts with Vue/React via the included middleware
- Guarded Actions —
data-confirmasks before any link or form goes through, no JavaScript to write - Laravel Boost Ready — ships a guideline and skill so AI assistants write v8 code, not v7
- Guided Upgrade —
php artisan alert:upgrademigrates a v7 codebase for you, with--dry-run
See It Running
AlertDeck is a Laravel app that
exercises every alert this package can produce — in Blade, in Livewire and in
Inertia, plus the guarded-action attributes, all seven themes, and routes
migrated from v7 by alert:upgrade.
Quick Start
composer require realrashid/sweet-alert
php artisan alert:install
Upgrading from v7? See what would change before anything is written:
php artisan alert:upgrade --dry-run
Add the Blade directive to your layout:
<head>
...
</head>
<body>
...
@sweetAlert
</body>
Fire an alert from any controller:
use RealRashid\SweetAlert\Facades\Alert;
Alert::title('Welcome!')
->success()
->text('Your account has been created.')
->flash();
return redirect()->route('dashboard');
Or use the global helper:
alert('Success!', 'Your data has been saved.', 'success');
return redirect()->back();
Documentation
Ready to explore all the features and options? Dive into our comprehensive documentation:
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
If you discover a security vulnerability, please help us maintain the security of this project by responsibly disclosing it to us. To report a security vulnerability, please send an email to realrashid05@gmail.com. We'll address the issue as promptly as possible.
Credits
Support My Work
If you find Laravel SweetAlert helpful and would like to support my work, you can buy me a coffee. Your support will help keep this project alive and thriving. It's a small token of appreciation that goes a long way.
License
The MIT License (MIT). Please see License File for more information.
Related Packages
A simple PHP package to show Sweet Alerts with the Laravel Framework
A simple PHP package to show Sweet Alerts with the Laravel Framework forked from...
A simple PHP package to show Sweet Alerts with the Laravel Framework
Version History
| Version | Released | PHP | Laravel | License |
|---|---|---|---|---|
| v8.0.0 | ^8.3 | ^11.0| | MIT | |
| v7.3.2 | ^7.2| | ^5.6| | MIT | |
| v7.3.1 | ^7.2| | ^5.6| | MIT | |
| v7.3.0 | ^7.2| | ^5.6| | MIT | |
| v7.2.0 | ^7.2| | ^5.6| | MIT | |
| v7.1.1 | ^7.2| | ^5.6| | MIT | |
| v7.1.0 | ^7.2| | ^5.6| | MIT | |
| v7.0.0 | ^7.2| | ^5.6| | MIT | |
| v6.0.0 | ^7.2| | ^5.6| | MIT | |
| v5.1.0 | ^7.2| | ^5.6| | MIT | |
| v5.0.0 | ^7.2| | ^5.6| | MIT | |
| v4.1.0 | ^7.2| | ^5.6| | MIT | |
| v4.0.0 | ^7.2| | ^7.0| | MIT | |
| v3.2.3 | ^7.2| | ^7.0| | MIT | |
| v3.2.2 | ^7.2| | ^5.4| | MIT | |
| v3.2.1 | ^7.2| | ^5.4| | MIT | |
| v3.2.0 | ^7.2| | ^5.4| | MIT | |
| v3.1.7 | ^7.2 | ^5.4| | MIT | |
| v3.1.6 | ^7.2 | ^5.4| | MIT | |
| v3.1.5 | ^7.2 | ^5.4| | MIT | |
| v3.1.4 | ^7.2 | ^5.4| | MIT | |
| v3.1.3 | ^7.2 | ^5.4| | MIT | |
| v3.1.2 | ^7.2 | ^5.4| | MIT | |
| v3.1.1 | ^7.2 | ~5.4.0| | MIT | |
| v3.1.0 | ^7.2 | ~5.4.0| | MIT | |
| v3.0.1 | ^7.2 | ~5.4.0| | MIT | |
| v3.0 | ^7.2 | ~5.4.0| | MIT | |
| v2.0.3 | ^7.2 | ~5.4.0| | MIT | |
| v2.0.2 | ^7.2 | ~5.4.0| | MIT | |
| v2.0.1 | ^7.2 | ~5.4.0| | MIT |
Showing the latest 30 of 35. See every release on Packagist
