Skip to content

benanamen/perfect-flash

Repository files navigation

codecov Code Coverage

Bugs Security Rating Maintainability Rating Vulnerabilities Quality Gate Status Duplicated Lines (%)

Scrutinizer Code Quality Build Status Code Intelligence Status

CodeFactor codebeat badge Maintainability

Code Coverage Reports

Dashboard
Overview
Detailed Report

FlashMessage Usage Guide:

The FlashMessage class is a convenient way to display messages to your users. It is initialized with a config array that contains messages for different types of actions. To use it, follow these steps:

(Assumes you have started a session)

Import the FlashMessage class into your code:

use PerfectApp\Flash\FlashMessage;

Create an instance of the FlashMessage class, passing the config array to its constructor:

$config = [
    'success' => [
        'create' => 'Item created successfully!',
        'update' => 'Item updated successfully!'
    ],
    'danger' => [
        'create' => 'Failed to create item.',
        'update' => 'Failed to update item.'
    ]
];
$flash = new FlashMessage($config);

To display a message, call the set() method on the $flash object. Pass the type of message ('success', 'danger', etc.), the action performed ('create', 'update', etc.), and optionally an icon to display with the message. Icons require Bootstrap 5:

$flash->set('success', 'create', '<i class="bi bi-check-circle-fill"></i>');

To display all messages, call the display() method on the $flash object:

$flash->display();

That's it! You can call set() and display() methods as many times as you need to display different messages to your users. The messages will be displayed in the order they were added, and will automatically be cleared after they are displayed.

About

Session Based Flash Messaging - Bootstrap 5

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published