jantinnerezo / livewire-alert
This package provides a simple alert utilities for your livewire components.
Requires
- php: ^8.1
- illuminate/support: ^10.0|^11.0|^12.0|^13.0
- livewire/livewire: ^3.0|^4.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.70
- orchestra/testbench: ^8.0|^9.0|^10.0|^11.0
- phpstan/phpstan: ^2.1
- phpunit/phpunit: ^9.5|^10.0|^11.5.3
- dev-master
- v4.x-dev
- v4.2.0
- v4.1.0
- 4.0.x-dev
- v4.0.9
- v4.0.8
- v4.0.7
- v4.0.6
- 4.0.5
- v4.0.4
- v4.0.3
- v4.0.2
- v4.0.1
- v4.0.0
- v3.0.3
- v3.0.2
- v3.0.1
- v3.0
- 2.2.7
- 2.2.6
- 2.2.5
- 2.2.4
- 2.2.3
- 2.2.2
- 2.2.1
- 2.2.0
- 2.1.9
- 2.1.8
- 2.1.7
- 2.1.6
- 2.1.5
- 2.1.4
- 2.1.3
- 2.1.2
- 2.1.1
- 2.1
- 2.0.2
- 2.0.1
- 2.0
- 1.2.0
- v1.0
- dev-jantinnerezo-patch-2
- dev-feat/more-methods
- dev-bugfix/all-events-triggers
- dev-feat/livewire-3-beta-support
- dev-jantinnerezo-patch-1
- dev-fix/failing-test
- dev-patch-2
- dev-hotfix/2.2.6
- dev-hotfix-2.2.3
- dev-feature/emit-performance
- dev-bugfix/extra-parameters
- dev-experimental-2.1.9
- dev-publishable
- dev-config
- dev-experimental
This package is auto-updated.
Last update: 2026-05-20 11:01:47 UTC
README
Livewire Alert is a Laravel Livewire package that brings SweetAlert2 notifications to your Livewire components through a fluent, chainable API. Configure and trigger beautiful, interactive alerts with a clean PHP interface — no JavaScript required.
📖 Documentation
Full documentation, live examples, and an interactive playground are hosted at:
👉 https://livewire-alert.jantinnerezo.me
Every feature — icons, positions, toasts, timers, buttons, confirm dialogs, loading alerts, in-place updates, inputs, flash alerts, images, custom classes, dependency injection and more — is documented there with copy-pasteable snippets and runnable demos.
Requirements
- PHP 8.1 or higher
- Laravel 10.x or higher
- Livewire 3.x or 4.x
- Composer
Installation
Require the package with Composer:
composer require jantinnerezo/livewire-alert
Optionally publish the config file:
php artisan vendor:publish --tag=livewire-alert:config
Install SweetAlert2 via npm or yarn:
npm install sweetalert2
yarn add sweetalert2
Then import it in resources/js/app.js:
import Swal from 'sweetalert2' window.Swal = Swal
Or include it via CDN before the closing </body> tag:
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
Filament
Register SweetAlert2 as a Filament asset in your AppServiceProvider:
use Filament\Support\Facades\FilamentAsset; use Illuminate\Support\Facades\Vite; use Filament\Support\Assets\Js; public function boot() { FilamentAsset::register([ Js::make('sweetalert2', Vite::asset('resources/js/sweetalert2.js')), // Or via CDN: // Js::make('sweetalert2', 'https://cdn.jsdelivr.net/npm/sweetalert2@11'), ]); }
Quick taste
use Jantinnerezo\LivewireAlert\Facades\LivewireAlert; public function save() { LivewireAlert::title('Changes saved!') ->success() ->show(); }
For everything else — head to the documentation site.
Looking for v3?
The last v3 release was v3.0.3 (March 11, 2024). v4 is a major refactor introducing the fluent Facade API, dependency injection, and many more features. For v3:
composer require jantinnerezo/livewire-alert:^3.0
Upgrading to v4 is recommended for new and ongoing projects.
Testing
composer test
Contributors
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email erezojantinn@gmail.com instead of using the issue tracker.
License
The MIT License (MIT). Please see License File for more information.