Alert messages

The Alert class can be used to display session based success or failed messages inside views. After a page refresh the message will be removed and the session will be unset.

Class: Alert

In this table you'll find information about the different methods you can use and what kind of data can be passed as an argument.

Method Arg Type Expect
message() 1 string session name

Setting a session flash message

The session name should be set to success or failed.


  namespace app\controllers;
  use core\Session;
  class ExampleController extends Controller {
    public function example() {    
      Session::set('success', 'Session message');
      redirect('/page to show the message');

Show the session flash message

Depending on the setted session name, different html classes will be shown.

<!DOCTYPE html>            
<html lang="en">            
  <?php core\Alert::message('success'); ?>