krubio/perfect-flash
Composer 安装命令:
composer require krubio/perfect-flash
包简介
Session Based Flash Messaging - Bootstrap 5
README 文档
README
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.
统计信息
- 总下载量: 3
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-03-26