yii-extension/alert-flash-bootstrap5

Alert Flash Bootstrap5 小部件。

此软件包的规范仓库似乎已消失,因此该软件包已被冻结。


README

68747470733a2f2f6c68332e676f6f676c6575736572636f6e74656e742e636f6d2f65685354506e5871726b6b304d33552d5550436a4330667479394b366c67796b4b32574f5541326e5548703867496b526a65544e387a385341426c6b766376522d39504972626f7849765047756a50675765624c51654848675837794c556f7846536475695a72546f6736576f5a4c694176716354523151545056526d6e733274596a414370703745513d7732343030

Alert Flash Bootstrap5 小部件


Total Downloads Build Status codecov Mutation testing badge static analysis type-coverage

安装

composer require yii-extension/alert-flash-bootstrap5

使用方法

Bootstrap5 的默认配置

docs\images\alert.png

在控制器或操作中

<?php

declare(strict_types=1);

namespace App\Action;

use Psr\Http\Message\ResponseInterface;
use Yiisoft\Session\Flash\Flash;

final class Action
{
    public function index(Flash $flash): ResponseInterface
    {
        $flash->add(
            'danger', // types: [danger, dark, info, primary, secundary, success, warning]
            [
                'body' =>  'Body message.', // body message
                'iconAttributes' => ['class' => 'fs-2 me-2'], // Its optional attributes tag i for icon.
            ],
            true
        );
    }
}

在布局中

<?php

declare(strict_types=1);

use Yii\Extension\Bootstrap5\AlertFlash;
use Yiisoft\Session\Flash\FlashInterface;

/**
 * @var FlashInterface $flash
 */
?>

<?= AlertFlash::widget([$this->flash])
    ->bodyAttributes(['class' => 'align-items-center d-flex'])
    ->layoutBody('{icon}{body}{button}')
    ->render() ?>

单元测试

该软件包使用 PHPUnit 进行测试。要运行测试

./vendor/bin/phpunit

突变测试

软件包测试使用 Infection 突变框架进行验证。要运行它

./vendor/bin/infection

静态分析

代码使用 Psalm 进行静态分析。要运行静态分析

./vendor/bin/psalm

许可

Yii Packages 的 yii-extension/alert-flash-bootstrap5 是自由软件。

它根据 BSD 许可协议发布。有关更多信息,请参阅 LICENSE

Yii Extension 维护。

支持项目

Open Collective

由 Yii 框架提供支持

Official website