PHP code example of varunsridharan / sweetalert2-php

1. Go to this page and download the library: Download varunsridharan/sweetalert2-php library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

varunsridharan / sweetalert2-php example snippets


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

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

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

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

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

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

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

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