yii-extension / alert-message-bootstrap5
Alert Flash Bootstrap5 Widget.
Installs: 2 064
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Open Issues: 6
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 Widget
Installation
composer require yii-extension/alert-flash-bootstrap5
Usage
Default config for Bootstrap5
In controller or action:
<?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 ); } }
In layout:
<?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() ?>
Unit testing
The package is tested with PHPUnit. To run tests:
./vendor/bin/phpunit
Mutation testing
The package tests are checked with Infection mutation framework. To run it:
./vendor/bin/infection
Static analysis
The code is statically analyzed with Psalm. To run static analysis:
./vendor/bin/psalm
License
The yii-extension/alert-flash-bootstrap5
for Yii Packages is free software.
It is released under the terms of the BSD License. Please see LICENSE
for more information.
Maintained by Yii Extension.