PHP code example of elmyrockers / ezflash

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

    

elmyrockers / ezflash example snippets


		use elmyrockers\EzFlash;
	

	$message = new EzFlash;
	

	$message->success = 'Message'; //Property
	$message['success'] = 'Message'; //Array key
	$message->success( 'Message' ); //Method call or
	$message( 'success', 'Message' ); //Function call
	

	echo $message(); //Function call with no parameter
	

	echo $message;
	

	$message( 'success', 'My message' ); //Set flash message through function call
	echo $message; // Echo flash message (one-time display)
	

	$message->setTemplate( ['success',
							'danger',
							'warning',
							'info',
							'primary',
							'secondary',
							'light',
							'dark',
							'default'], '<div class="alert alert-{$key}">{$message}</div>' ); //default

	//custom template
	$message->setTemplate( 'errorInfo', '<div class="alert alert-danger {$key}">{$message}</div>' );