Skip to content
Sweetalert2 Code Builder In PHP
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
README.md
composer.json
sweetalert2.php

README.md

SweetAlert2


A beautiful, responsive, customizable, accessible (WAI-ARIA) replacement for JavaScript's popup boxes. Zero dependencies.


See SweetAlert2 in action ↗

Latest Stable Version Latest Unstable Version Total Downloads WP License composer.lock available


👉 This Custom PHP Lib depends on SweetAlert2 JS Lib and this php class works as Javascript code builder.


Installation

The preferred way to install this extension is through Composer.

To install VSP_Framework library, simply:

$ composer require varunsridharan/sweetalert2-php

The previous command will only install the necessary files, if you prefer to download the entire source code you can use:

$ composer require varunsridharan/sweetalert2-php --prefer-source

You can also clone the complete repository with Git:

$ git clone https://github.com/varunsridharan/sweetalert2-php.git

Or install it manually:

Download VSP_Framework.zip:

$ wget https://github.com/varunsridharan/sweetalert2-php/archive/master.zip

Notice

$data = swal2('Success','Your Email is sent','success');
echo '<script>'.$data.'</script>';

Notice With Timer

$data = swal2('Success','Your Email is sent','success');
$data->timer(500);
echo '<script>'.$data.'</script>';

Useful Functions

Simple Notice

/**
 * @param string $title
 * @param string $content
 * @param string $type
 *
 * @return \SweetAlert2
 */
 swal2( $title = '', $content = '', $type = 'success' )

Success Notice

/**
 * @param string $title
 * @param string $content
 *
 * @return \SweetAlert2
 */
 swal2_success( $title = '', $content = '' )

Info Notice

/**
 * @param string $title
 * @param string $content
 *
 * @return \SweetAlert2
 */
 swal2_info( $title = '', $content = '' )

Question Notice

/**
 * @param string $title
 * @param string $content
 *
 * @return \SweetAlert2
 */
 swal2_question( $title = '', $content = '' ) 

Warning Notice

/**
 * @param string $title
 * @param string $content
 *
 * @return \SweetAlert2
 */
 swal2_warning( $title = '', $content = '' )

Error Notice

/**
 * @param string $title
 * @param string $content
 *
 * @return \SweetAlert2
 */
 swal2_error( $title = '', $content = '' )

Contribute

If you would like to help, please take a look at the list of issues or the To Do checklist.

License

This project is licensed under General Public License v3.0 license. See the LICENSE file for more info.

Copyright

2017 - 2018 Varun Sridharan, varunsridharan.in

If you find it useful, let me know 😉

You can contact me on Twitter or through my email.

Backed By

DigitalOcean JetBrains Tidio Chat
You can’t perform that action at this time.