terabytesoftw / widget-alert
Bootstrap4 Widget Alert
dev-master / 1.0.x-dev
2019-06-25 13:48 UTC
Requires
- php: >=5.4.0
- oomphinc/composer-installers-extender: ^1.1
- yiisoft/yii2: ^2.0.20
- yiisoft/yii2-bootstrap4: ^2.0.3
Requires (Dev)
- codeception/c3: 2.*
- codeception/codeception: ^3.0
- hiqdev/composer-config-plugin: ^1.0@dev
- monolog/monolog: *
This package is auto-updated.
Last update: 2023-09-16 01:30:57 UTC
README
Bootstrap 4 Widget Alert
目录结构:
config/ contains widget configurations
src/ contains source widget file
tests/ contains test codeception
需求:
本扩展至少需要您的Web服务器支持PHP 7.2。
安装:
如果您没有Composer,您可以按照getcomposer.org上的说明进行安装。
然后,您可以使用以下命令安装此项目模板
Linux
php composer.phar require --prefer-dist terabytesoftw/alert "^1.0-dev"
Windows
composer require --prefer-dist terabytesoftw/alert "^1.0-dev"
使用:
警报小部件从会话闪存中渲染消息。所有闪存消息都按setFlash分配的顺序显示。您可以按以下方式设置消息:
闪存消息
Controllers: $this->module->session->setFlash('primary', 'A simple primary alert—check it out!'); Views: $this->context->module->session->setFlash('primary', 'A simple primary alert—check it out!');
Controllers: $this->module->session->setFlash('danger', 'This is the message'); $this->module->session->setFlash('success', 'This is the message'); $this->module->session->setFlash('info', 'This is the message'); $this->module->session->setFlash('light', 'This is the message'); $this->module->session->setFlash('primary', 'This is the message'); $this->module->session->setFlash('secondary', 'This is the message'); $this->module->session->setFlash('success', 'This is the message'); $this->module->session->setFlash('warning', 'This is the message'); Views: $this->context->module->session->setFlash('danger', 'This is the message'); $this->context->module->session->setFlash('success', 'This is the message'); $this->context->module->session->setFlash('info', 'This is the message'); $this->context->module->session->setFlash('light', 'This is the message'); $this->context->module->session->setFlash('primary', 'This is the message'); $this->context->module->session->setFlash('secondary', 'This is the message'); $this->context->module->session->setFlash('success', 'This is the message'); $this->context->module->session->setFlash('warning', 'This is the message');
可以按如下方式设置多个消息
Controllers: $this->module->session->setFlash('error', ['Error 1', 'Error 2']); Views: $this->context->module->session->setFlash('error', ['Error 1', 'Error 2']);
用法:Layouts\View
use terabytesoft\widgets\Alert; <?= Alert::widget() ?>
运行测试 Codeception:
// download all composer dependencies root project
$ composer update --prefer-dist -vvv
// run all tests with code coverage
$ vendor/bin/codecept run unit --coverage-xml
Web服务器支持:
- Apache。
- Nginx。
- OpenLiteSpeed。