krubio/perfect-flash-bs-5 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

krubio/perfect-flash-bs-5

最新稳定版本:v0.1.0

Composer 安装命令:

composer require krubio/perfect-flash-bs-5

包简介

SOLID Compliant Session Based Flash Messaging - Bootstrap 5

README 文档

README

codecov

Scrutinizer Code Quality Code Coverage Build Status Code Intelligence Status

Coverage Maintainability Rating Code Smells Technical Debt Quality Gate Status Reliability Rating

Duplicated Lines (%) Vulnerabilities Bugs Security Rating

Bootstrap5FlashMessage

Description

Bootstrap5FlashMessage is a PHP class that provides a simple and effective way to display flash messages in a web application. It uses Bootstrap 5 for styling and allows for optional icons and dismissible alerts.

Requirements

  • PHP 8.0 or higher
  • Bootstrap 5.3 or higher

Installation

Include the Bootstrap5FlashMessage class in your project.

Usage

Initialization

First, you need to inject a session object that implements SessionInterface and an array of messages into the constructor.

use PerfectApp\Session\SessionInterface;
use PerfectApp\Bootstrap5FlashMessage;

$session = new Session();  // This should implement SessionInterface
$messages = [
    'success' => [
        'insert' => 'Record Inserted'
    ],
    'danger' => [
        'failed_login' => 'Invalid Login'
    ]
];

$flash = new Bootstrap5FlashMessage($session, $messages);

Adding a Message

To add a flash message, use the addMessage method.

$flash->addMessage('success', 'insert');

You can also add an optional icon and make the alert dismissible.

$flash->addMessage('danger', 'failed_login', 'bi-x-circle', true);

Displaying Messages

To display all the flash messages, use the displayMessages method.

$flash->displayMessages();

This will output Bootstrap 5 styled alerts.

Testing

Run the following command to execute the unit tests and ensure 100% code coverage:

php vendor/bin/codecept run --coverage --coverage-html  --coverage-xml

License

This project is licensed under the MIT License.

统计信息

  • 总下载量: 21
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-10-10