PHP code example of romanato / php-flashingo-messages

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

    

romanato / php-flashingo-messages example snippets


// Create new instance
$flashingo = new Romanato\FlashingoMessage\FlashingoMessage;

// Set flash message
$flashingo->set('This is a flash message.');

// Display messages
$flashingo->displayAll();

// Set type using set method
$flashingo->set('This is a flash error message.', 'error');

// Set type using shorter method
$flashingo->setWarning('This is an warning but shorter.');

// Set options
$flashingo->set('I am awesome!', 'warning', [
  'name' => 'awesomeId',
  'class' => 'specialClass'
]);

$flashingo->setSuccess('I am awesome!', [
  'name' => 'awesomeId',
  'class' => 'specialClass'
]);

// Display message by name
$flashingo->display('awesomeId');

public $cssDefaultClass = 'myAwesomeClass';

public $types = [
  'default' => 'alert-primary',
  'error' => 'alert-error',
  'warning' => 'alert-warning',
  'info' => 'alert-info',
  'success' => 'alert-success',
  'custom' => 'alert-custom',
];

$flashingo->set($message, $type, [
    'class' => $class,
    'name' => $name
]);

$flashingo->setError($message, [
    'class' => $class,
    'name' => $name
]);

$flashingo->setWarning($message, [
    'class' => $class,
    'name' => $name
]);

$flashingo->setInfo($message, [
    'class' => $class,
    'name' => $name
]);

$flashingo->setSuccess($message, [
    'class' => $class,
    'name' => $name
]);

$flashingo->setDefault($message, [
    'class' => $class,
    'name' => $name
]);

$flashingo->display($name);

$flashingo->displayAll();

$flashingo->destroyAll();

composer