Centum\Flash
Centum\Flash\Flash
is used to display messages to users. Messages are stored in the session so they are useful for providing information after a form submission or redirect.
Centum\Flash\Flash(
Centum\Interfaces\Flash\StorageInterface $storage,
Centum\Interfaces\Flash\FormatterInterface $formatter
);
Centum\Flash\Flash
implements Centum\Interfaces\Flash\FlashInterface
.
To add a message to the Flash, use any of the following methods: danger()
, success()
, info()
, or warning()
:
$flash->danger(
"This is an example message."
);
And now you can output the messages in your view:
echo $flash->output();
If you’re using Twig, you can also use the Flash Twig extension.