Download the PHP package squareboat/alert without Composer
On this page you can find all versions of the php package squareboat/alert. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download squareboat/alert
More information about squareboat/alert
Files in squareboat/alert
Package alert
Short Description An easy way for Laravel flash notifications using sweetalert JS plugin.
License MIT
Informations about the package alert
Laravel Alert Notifications
Laravel alert notifications using a beautiful javascript alert (sweet-alert).
Install
Install via composer
Configure Laravel
Once installation operation is complete, simply add both the service provider and facade classes to your project's config/app.php
file:
Service Provider
Facade
Download & install Sweet Alert library
Download the .js
and .css
from the website
or
Install through bower
or
Install through NPM:
Finally, include default alert view to your layout
Package default provides bootstrap ready alert view. Just include alert::message
file to your main layout in blade:
or if you don't use blade:
If you need to modify the alert message partials, you can run:
The package view will now be located in the resources/views/vendor/alert
directory.
And that's it! With your coffee in reach, start flashing out alert messages!
Usage
Within your controllers, before you perform a redirect...
Level for all alerts are following:
Success
or
Basic
or
Info
or
Warning
or
Error
or
Default View
The sweet_alert.alert
session key contains a JSON configuration object to pass it directly to Sweet Alert swal()
funtion.
Default view considers that you have initialized the sweetalert plugin by referencing the necessary files and uses its swal()
function.
If swal()
function is not defined then default view declares a javascript variable sweet_alert
which you can use anywhere you like.
Final Considerations
By default, all alerts will dismiss after a sensible default number of seconds. But no fear, if you need to specify a different time you can:
Remember!, the number is set in milliseconds
Also, if you need the alert to be persistent on the page until the user dismiss it by pressing the alert confirmation button:
The optional text will appear in the button otherwise default text OK
is shown.
License
The MIT License. Please see SquareBoat