# f3-flash **Repository Path**: wfdaj/f3-flash ## Basic Information - **Project Name**: f3-flash - **Description**: No description available - **Primary Language**: Unknown - **License**: GPL-3.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-02-21 - **Last Updated**: 2024-02-21 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Flash This is a little plugin to add simple Flash Messages and Flash Keys for PHP Fat-Free-Framework, version 3.x ### Installation - Method 1: use composer `composer require ikkez/f3-flash` - Method 2: copy the `flash.php` file into your F3 `lib/` directory or another directory that is known to the [AUTOLOADER](https://fatfreeframework.com/quick-reference#AUTOLOAD) ### Usage To add a message (or multiple) that should only be displayed once in your template on the next request, just do: ```php \Flash::instance()->addMessage('You did that wrong.', 'danger'); // or \Flash::instance()->addMessage('It worked!', 'success'); ``` And to display that in your templates do: ```html
{{ @msg.text | raw }}
{{ @msg.text | raw }}
``` That's it. If you need, you could also add simple keys: ```php $flash = \Flash::instance() $f3->set('FLASH', $flash); $flash->setKey('highlight','bg-success'); // with value $flash->setKey('show-hint'); // without returns just TRUE $flash->setKey('error','Catastrophic error occured! '); ``` for use cases like: ```html

It's new !!!

...
``` ```html

{{ @FLASH->getKey('error') }}

``` ## License You are allowed to use this plugin under the terms of the GNU General Public License version 3 or later. Copyright (C) 2021 Christian Knuth [ikkez]