PHP code example of hexbit / php-flash

1. Go to this page and download the library: Download hexbit/php-flash 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/ */

    

hexbit / php-flash example snippets


use Hexbit\Flash\Flash;

// first initialize it:
Flash::init();


// build a new instance of flash
$flash = new Flash();

// simple usage and redirect back!
$flash->redirectBy('contact')
        ->message('failed', 'It seems your email is not valid!')
        ->redirectBack();

// redirect to specific location
$flash->redirectBy('contact')
        ->redirectLocation("https://somewhere/")
        ->withStatus(302)
        ->message('failed', 'It seems your email is not valid!')
        ->redirect();

// redirect to specific location and then redirect again after 5 seconds!
$flash->redirectLocation("https://somwhere/")
        ->message('failed', 'It seems your email is not valid!')
        ->secondRedirect(5, "https://somewhereelse/")
        ->redirect();




if (isset($_SESSION['failed']) {
        // show your error message for example
}

bash
composer