Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Sweet Alert Laravel Package

realrashid/sweet-alert

Laravel package to integrate SweetAlert2 popups: stylish alerts, confirmations, toasts, and notifications. Trigger from controllers or views with simple helpers and session flashes, customize options, and improve UX with minimal setup.

View on GitHub
Deep Wiki
Context7

Helper Methods

Persistent Alert

persistent($showConfirmBtn = true, $showCloseBtn = false)

// example:
alert()->success('SuccessAlert','Lorem ipsum dolor sit amet.')->persistent(true,false);
AutoClose Alert

autoClose($milliseconds = 5000)

// example:
toast('Success Toast','success')->autoClose(5000);
Position

position($position = 'top-end')

Modal window and Toast position, can be 'top', 'top-start', 'top-end', 'center', 'center-start', 'center-end', 'bottom', 'bottom-start', or 'bottom-end'.

// example:
alert('Title','Lorem Lorem Lorem', 'success')->position('top-end');
ShowConfirmButton

showConfirmButton($btnText = 'Ok', $btnColor = '#3085d6')

// example:
alert()->success('SuccessAlert','Lorem ipsum dolor sit amet.')->showConfirmButton('Confirm', '#3085d6');
ShowCancelButton

showCancelButton($btnText = 'Cancel', $btnColor = '#aaa')

// example:
alert()->question('Are you sure?','You won\'t be able to revert this!')->showCancelButton('Cancel', '#aaa');
ShowCloseButton

showCloseButton($closeButtonAriaLabel = 'aria-label')

// example:
toast('Post Updated','success','top-right')->showCloseButton();
HideCloseButton

hideCloseButton()

// example:
toast('Post Updated','success','top-right')->hideCloseButton();
ReverseButtons

reverseButtons()

// example:
alert()->question('Are you sure?','You won\'t be able to revert this!')
->showConfirmButton('Yes! Delete it', '#3085d6')
->showCancelButton('Cancel', '#aaa')->reverseButtons();
Footer

footer($HTMLcode)

// example:
alert()->error('Oops...', 'Something went wrong!')->footer('<a href="#">Why do I have this issue?</a>');
ToToast

toToast($position = 'top-right')

// example:
alert()->success('Post Created', 'Successfully')->toToast();
ToHTML

toHtml()

// example:
alert()->success('Post Created', '<strong>Successfully</strong>')->toHtml();
AddImage

addImage($imageUrl)

This will remove alert type and add close button

// example:
alert('Title','Lorem Lorem Lorem', 'success')->addImage('https://unsplash.it/400/200');
Width

width('32rem')

Modal window width, including paddings (box-sizing: border-box). Can be in px or %. The default width is 32rem.

// example:
alert('Title','Lorem Lorem Lorem', 'success')->width('720px');
Padding

padding('1.25rem')

Modal window padding. Can be in px or %. The default padding is 1.25rem.

// example:
alert('Title','Lorem Lorem Lorem', 'success')->padding('50px');
Background

background('#fff')

Modal window background (CSS background property). The default background is '#fff'.

// example:
alert('Title','Lorem Lorem Lorem', 'success')->background('#fff');
Animation

animation($showAnimation, $hideAnimation)

Custom animation with Animate.css

// example:
alert()->info('InfoAlert','Lorem ipsum dolor sit amet.')
->animation('tada faster','fadeInUp faster');

Note: Animate.css CDN link is imported in package config file,

Button Styling

buttonsStyling($buttonsStyling)

Apply default styling to buttons. If you want to use your own classes (e.g. Bootstrap classes) set this parameter to false.

// example:
alert()->success('Post Created', 'Successfully')->buttonsStyling(false);
Icon Html

iconHtml($iconHtml)

Use any HTML inside icons (e.g. Font Awesome)

// example:
alert()->success('Post Created', 'Successfully')->iconHtml('<i class="far fa-thumbs-up"></i>);
Focus Confirm

focusConfirm(true)

Set to false if you want to focus the first element in tab order instead of "Confirm"-button by default.

// example:
alert()->question('Are you sure?','You won\'t be able to revert this!')->showCancelButton()->showConfirmButton()->focusConfirm(true);
Focus Cancel

focusCancel(false)

Set to true if you want to focus the "Cancel"-button by default.

// example:
alert()->question('Are you sure?','You won\'t be able to revert this!')->showCancelButton()->showConfirmButton()->focusCancel(true);
Timer Progress Bar

timerProgressBar()

The timer will have a progress bar at the bottom of a popup. Mostly, this feature is useful with toasts.

// example:
toast('Signed in successfully','success')->timerProgressBar();
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport