PHP code example of mzur / kirby-flash

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

    

mzur / kirby-flash example snippets


flash('thanks_message', 'Thank you for contacting us!');

 if (flash('thanks_message')): 

flash('key', 'value');

flash('messages.success', ['Thanks for your feedback!']);
flash('messages.errors', ['Email is a 

$value = flash('key');

$success_messages = flash('messages.success'); // Array( 0 => 'Thanks for your feedback!' )
$username = flash('username'); // "jimihendrix"

flash('messages.errors', [
    'Email is messages.errors'); // Array( 0 => 'Email is 

 if (count(flash('messages.errors')) > 0): 

flash('my_key');

flash('my_other_key', 'Some Value');
flash('my_other_key', 'Some Other Value');

flash('my_other_key'); // "Some Other Value"

flash('messages.errors', ['Email is ( 0 => 'Email is 

flash('message', 'Message for redirect'); // Keep for next request
flash('message', 'Message for this response', true); // Keep only for current request

## Session Key

By default Flash stores data under the session key `_flash`.

So you *could* access flash data like `$kirby->session()->get('_flash')` if you wanted to.

### Changing the Session Key

Use the static method to change the flash key. (You should probably do this early on in your app, probably in `index.php` or `site.php`.)


Jevets\Kirby\Flash::sessionKey();