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/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: 2024-01-10 21:42:46 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 Packages 的 yii-extension/alert-flash-bootstrap5
是自由软件。
它根据 BSD 许可协议发布。有关更多信息,请参阅 LICENSE
。
由 Yii Extension 维护。