All Projects → softon → sweetalert

softon / sweetalert

Licence: MIT license
Laravel 5 Package for SweetAlert2. Use this package to easily show sweetalert2 prompts in your laravel app.

Programming Languages

PHP
23972 projects - #3 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to sweetalert

sms
Simple SMS Gateway Package for sending short text messages from your Application. Facade for Laravel 5(Updated to work with Laravel 5.5).Currently supported Gateways Clickatell, MVaayoo, Gupshup, SmsAchariya, SmsCountry, SmsLane, Nexmo, Mocker / Any HTTP/s based Gateways are supported by Custom Gateway. Log gateway can be used for testing.
Stars: ✭ 41 (+46.43%)
Mutual labels:  laravel-package, laravel-5-package, laravel55
Voyager Hooks
Hooks system integrated into Voyager.
Stars: ✭ 200 (+614.29%)
Mutual labels:  laravel-package, laravel-5-package
Blogetc
Easily add a full Laravel blog (with built in admin panel and public views) to your laravel project with this simple package.
Stars: ✭ 198 (+607.14%)
Mutual labels:  laravel-package, laravel-5-package
Sneaker
An easy way to send emails whenever an exception occurs on server.
Stars: ✭ 223 (+696.43%)
Mutual labels:  laravel-package, laravel-5-package
Laravel Auto Translate
Automatically translate your language files using a translator service
Stars: ✭ 153 (+446.43%)
Mutual labels:  laravel-package, laravel-5-package
Telegram Bot Sdk
🤖 Telegram Bot API PHP SDK. Lets you build Telegram Bots easily! Supports Laravel out of the box.
Stars: ✭ 2,212 (+7800%)
Mutual labels:  laravel-package, laravel-5-package
Hooks
Hooks is a extension system for your Laravel application.
Stars: ✭ 202 (+621.43%)
Mutual labels:  laravel-package, laravel-5-package
Larabug
Laravel error reporting tool
Stars: ✭ 84 (+200%)
Mutual labels:  laravel-package, laravel-5-package
Laravel Gitscrum
GitScrum is a Project Management Tool, developed to help entrepreneurs, freelancers, managers, and teams Skyrocket their Productivity with the Agile methodology and Gamification.
Stars: ✭ 2,686 (+9492.86%)
Mutual labels:  laravel-package, laravel-5-package
laravel-two-factor-authentication
A two-factor authentication package for Laravel >= 8
Stars: ✭ 37 (+32.14%)
Mutual labels:  laravel-package, laravel-5-package
flash
An easy way for Laravel flash notifications.
Stars: ✭ 14 (-50%)
Mutual labels:  laravel-package, laravel-5-package
Pagination
🎁 Laravel 5 Custom Pagination Presenter
Stars: ✭ 119 (+325%)
Mutual labels:  laravel-package, laravel-5-package
Eye
Eyewitness.io package for Laravel 5 applications
Stars: ✭ 114 (+307.14%)
Mutual labels:  laravel-package, laravel-5-package
Laravel Page Speed
Package to optimize your site automatically which results in a 35%+ optimization
Stars: ✭ 2,097 (+7389.29%)
Mutual labels:  laravel-package, laravel-5-package
Laravel Excel
🚀 Supercharged Excel exports and imports in Laravel
Stars: ✭ 10,417 (+37103.57%)
Mutual labels:  laravel-package, laravel-5-package
Voyager Frontend
The Missing Front-end for The Missing Laravel Admin 🔥
Stars: ✭ 200 (+614.29%)
Mutual labels:  laravel-package, laravel-5-package
voyager-page-blocks
A module to provide page blocks for Voyager 📝
Stars: ✭ 80 (+185.71%)
Mutual labels:  laravel-package, laravel-5-package
Laraupdater
Enable Laravel App Self-Update. Allow your Laravel Application to auto-update itself.
Stars: ✭ 75 (+167.86%)
Mutual labels:  laravel-package, laravel-5-package
Laravel Pdf
A Simple package for easily generating PDF documents from HTML. This package is specially for laravel but you can use this without laravel.
Stars: ✭ 79 (+182.14%)
Mutual labels:  laravel-package, laravel-5-package
Auth Tests
Always-current tests for Laravel's authentication system. Curated by the community.
Stars: ✭ 230 (+721.43%)
Mutual labels:  laravel-package, laravel-5-package

SweetAlert 2

Laravel 5 Package for SweetAlert 2. Use this package to easily show SweetAlert prompts in your Laravel application.

Installation

  1. Use composer to install the package
$ composer require softon/sweetalert
  1. (Optional for Laravel 5.5) Add the service provider to the config/app.php file in Laravel
Softon\SweetAlert\SweetAlertServiceProvider::class,
  1. (Optional for Laravel 5.5) Add an alias for the Facade to the config/app.php file in Laravel
'SWAL' => Softon\SweetAlert\Facades\SWAL::class,
  1. Publish the config & views by running
$ php artisan vendor:publish

View

This package does have its own views to be included in your templates. But if you would like to tweak it or include your own you can use the views published in the resources/views/vendor/sweetalert directory.

This package also includes a SweetAlert2 CDN that you can include if you have not included the SweetAlert2 Javascript file from their website. The CDN view must be loaded first.

For built in views, you can use this in your blade templates before the closing body tag

@include('sweetalert::cdn')         // Optional needed only if SweetAlert2 files are not inserted by the developer 
@include('sweetalert::view')
@include('sweetalert::validator')   // Optional needed only to show form validation errors automatically

Or for the Published Views use this

@include('vendor.sweetalert.cdn')   // Optional needed only if SweetAlert2 files are not inserted by the developer
@include('vendor.sweetalert.view')
@include('vendor.sweetalert.validator')   // Optional needed only to show form validation errors automatically

Configuration

You can change the basic parameters of the package by referring to the SweetAlert2 documentations for more details.

Usage

You may use the SWAL Facade or the swal helper function to call the methods.

Showing a Message to User using the SWAL Facade:

use Softon\SweetAlert\Facades\SWAL;  

// Params: [Title,Text,Type,Options[]]
SWAL::message('Good Job','You have successfully logged In!','info');  
SWAL::message('Good Job','You have successfully logged In!','error');  
SWAL::message('Good Job','You have successfully logged In!','success',['timer'=>2000]);

// For All available options please refer the SweetAlert 2 Docs

Showing a Message to User using the swal helper function:

// Message Type Can be `warning`, `error`, `success`, `info` and `question`. Based on this there are some convinence function that can be used instead of the message method.:
swal('Your Title','Text');
swal()->message('Good Job','You have successfully logged In!','info');  
swal()->message('Good Job','You have successfully logged In!','error');  
swal()->message('Good Job','You have successfully logged In!','success',['timer'=>2000]);
// Params [Title, Text, Options]
swal()->warning('Good Job','You have successfully logged In!',[]);
swal()->error('Good Job','You have successfully logged In!',[]);
swal()->success('Good Job','You have successfully logged In!',[]);
swal()->info('Good Job','You have successfully logged In!',[]);
swal()->question('Good Job','You have successfully logged In!',[]);

To show modal which will autoclose after few seconds:

swal()->autoclose(2000)->message('Good Job','You have successfully logged In!','info'); 
swal()->autoclose(5000)->success('Good Job','You have successfully logged In!'); 

To show a toast modal which will autoclose after few seconds:

swal()->toast()->autoclose(2000)->message('Good Job','You have successfully logged In!','info'); 

To change confirm button text:

swal()->button('Close Me')->message('Good Job','You have successfully logged In!','info'); 

// Button Params [Button Text,Button Colour, SWAL Style Enable / Disable, Style Class for Buttons]
swal()->button('Close Me','#efefef',false,'btn btn-primary')->info('Good Job','You have successfully logged In!'); 

To change position of the modal:

// Possible Positions : `top`, `top-left`, `top-right`, `center`, `center-left`, `center-right`, `bottom`, `bottom-left`, or `bottom-right`
swal()->position('top')->message('Good Job','You have successfully logged In!','info'); 

You can chain any of these methods to combine the functionality:

swal()->position('bottom-right')->autoclose(3000)->toast()->message('This is A Custom Message');
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].
OSZAR »