- How do I install wavey/sweetalert in a Laravel application?
- Install it with composer require wavey/sweetalert. Laravel package auto-discovery should register the service provider and facade, but you may need to publish the config file and include the Blade component or directive in your layout. Check the Composer constraint resolution against your Laravel and PHP versions first, because the last upstream release predates Laravel 10 and 11.
- Does wavey/sweetalert support Laravel 10 and Laravel 11?
- The last release was in November 2022, so it predates Laravel 10 and 11 becoming standard. Composer may fail to resolve or may pull an older constraint set on PHP 8.2 and 8.3. Test installation on your exact matrix before committing, and be prepared to widen the Laravel constraint in a fork if needed.
- How do I show a SweetAlert2 confirmation dialog from a Laravel controller?
- Use the package helper or facade to queue an alert with a title, text, icon, and confirmation options, then return your redirect or view response. The payload is written into the session flash bag and rendered by the Blade partial on the next page load. Remember that the actual confirm or cancel decision happens client-side in SweetAlert2, so wire the confirmed action to a form submit or AJAX call.
- How do queued alerts survive a redirect in Laravel?
- The package stores alert payloads in Laravel's session flash data, so they persist for exactly one subsequent request. After redirect()->with() or the package's fluent call, the Blade partial emits the Swal.fire call on DOM ready. Verify that the session flash key does not collide with your existing flash messaging conventions.
- Is wavey/sweetalert safe from XSS when alert text contains user input?
- Do not assume it is safe. Alert content often includes names, IDs, or validation errors, and SweetAlert2 supports an html option that would render unescaped markup. Review how the Blade partial escapes message text and whether the API exposes a raw-HTML path you should ban or sanitize.
- Does wavey/sweetalert load SweetAlert2 from a CDN?
- The package may pull SweetAlert2 from a CDN or expect you to publish its assets, so check the config and Blade partial rather than inheriting the default. A CDN source adds a CSP and availability dependency, while vendored assets add an upgrade burden. Make that choice explicitly, especially for offline or air-gapped deployments.
- What are alternatives to wavey/sweetalert for Laravel notifications?
- You can use SweetAlert2 directly via npm and emit Swal.fire from your own Blade or component layer. Other options include Toastr wrappers, broader Laravel notification packages, or a small custom session-flash helper. For Inertia or Livewire apps, handling dialogs in the component layer is usually cleaner than bridging page-reload flash semantics.
- How do I configure icons, positions, and timers in wavey/sweetalert?
- Publish the package config to set defaults such as icon, position, timer, and whether to show confirmation buttons. Per-call options usually override the defaults through the fluent helper or facade. Common icons include success, error, warning, info, and question, and positions include top-end, center, and bottom.
- Can I use wavey/sweetalert with Livewire or Inertia?
- It is a weak fit for Livewire-heavy, Inertia, or SPA front ends because the package is built around session flash and full page reloads. In those stacks, confirmation dialogs belong in the component layer, and passing flash data into JSON props takes only a few lines of your own code. Use it mainly in server-rendered Blade monoliths.
- Is wavey/sweetalert actively maintained?
- The last release was 2022-11-19, with around 49 stars and no known dependents, which suggests a single-maintainer bus factor. Treat adoption as a fork decision: vendor the relevant source into your own namespace, pin the Laravel constraint yourself, and keep the public API identical. That limits removal cost if upstream stays dormant.