Skip to content
Store messages across requests
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Flash component

The Flash component allows to store data across requests and objects with a session or request level scope. It is primarily designed to store messages accross requests.


$flash = new Gobline\Flash\Flash();

$flash->next('error', 'User email is invalid'); // sets a message that will be available in the next request

$flash->get('error'); // message only available in the next request, throws \InvalidArgumentException

$flash->get('error', 'foo'); // message only available in the next request, returns default "foo" value

$flash->now('info', 'Three credits remain in your account'); // message available in the current request

$flash->get('info'); // returns "Three credits remain in your account"

$flash->keep(); // keep messages set in the previous request so they will be available in the next request

Note that messages stored with next() are made available for the next request but not the request after that one. keep() allows to keep the same messages accross multiple requests.


You can install the Flash component using the dependency management tool Composer. Run the require command to resolve and download the dependencies:

composer require gobline/flash
You can’t perform that action at this time.