yii-extension / alert-message-bootstrap5
此包已被废弃,不再维护。作者建议使用https://github.com/yii-extension/alert-flash-bootstrap5包。
Alert Flash Bootstrap5 小部件。
dev-master / 1.0.x-dev
2021-09-28 19:17 UTC
Requires
- php: ^7.4|^8.0
- yii-extension/asset-bootstrap5: ^1.0.0
- yii-extension/widgets: ^1.0.0
- yiisoft/session: ^1.0
Requires (Dev)
- nyholm/psr7: ^1.4.0
- phpunit/phpunit: ^9.5
- roave/infection-static-analysis-plugin: ^1.8
- vimeo/psalm: ^4.8
- dev-master / 1.0.x-dev
- dev-dependabot/composer/vimeo/psalm-tw-5.8
- dev-dependabot/github_actions/actions/cache-3.3.0
- dev-dependabot/composer/vimeo/psalm-tw-5.7
- dev-dependabot/composer/yiisoft/session-tw-2.0
- dev-dependabot/github_actions/shivammathur/setup-php-2.24.0
- dev-dependabot/github_actions/actions/checkout-3.3.0
- dev-dependabot/github_actions/codecov/codecov-action-3.1.1
This package is auto-updated.
Last update: 2023-03-10 19:57:40 UTC
README
Alert Flash Bootstrap5 小部件
安装
composer require yii-extension/alert-flash-bootstrap5
使用
Bootstrap5 的默认配置
在控制器或动作中
<?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 包的yii-extension/alert-flash-bootstrap5
是免费软件。
它根据BSD许可证发布。有关更多信息,请参阅LICENSE
。
由Yii Extension维护。