dominus77/yii2-noty

Renders a Noty3 widget for Yii2.

Installs: 5 962

Dependents: 1

Suggesters: 0

Security: 0

Stars: 1

Watchers: 2

Forks: 1

Open Issues: 0

Type:yii2-extension

v1.0.5 2021-07-09 06:51 UTC

This package is auto-updated.

Last update: 2024-04-09 12:56:26 UTC


README

Latest Version Software License Build Status codecov Scrutinizer Code Quality SymfonyInsight

Noty widget for Yii2

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require dominus77/yii2-noty

or add

"dominus77/yii2-noty": "^1.0"

to the require section of your composer.json file.

Usage

Once the extension is installed, simply use it in your layout file like this:

Controller:

<?php
// ...
Yii::$app->session->setFlash(\dominus77\noty\NotyWidget::TYPE_SUCCESS, 'Hello World!');
// ...

also

<?php
// ...
Yii::$app->session->setFlash('key1', [
    \dominus77\noty\NotyWidget::TYPE_SUCCESS,
    'Hello World!', 
    // Type options
    [
        'timeout' => 3000
    ],
    // Options
    [
        'progressBar' => true,
        'layout' => \dominus77\noty\NotyWidget::LAYOUT_TOP_RIGHT,
        'theme' => \dominus77\noty\NotyWidget::THEME_MINT
    ]
]);
// ...

View:

<?php
use dominus77\noty\NotyWidget;
?>

<?php NotyWidget::widget(); ?>

also

<?php
use dominus77\noty\NotyWidget;
?>

<?php NotyWidget::widget([
    'typeOptions' => [
        NotyWidget::TYPE_SUCCESS => ['timeout' => 3000],
        NotyWidget::TYPE_INFO => ['timeout' => 3000],
        NotyWidget::TYPE_ALERT => ['timeout' => 3000],
        NotyWidget::TYPE_ERROR => ['timeout' => 5000],
        NotyWidget::TYPE_WARNING => ['timeout' => 3000]
    ],
    'options' => [
        'progressBar' => true,
        'timeout' => false,
        'layout' => NotyWidget::LAYOUT_TOP_CENTER,
        'dismissQueue' => true,
        'theme' => NotyWidget::THEME_SUNSET
    ],
]); ?>

More Information

Please, check the Noty

Testing

$ vendor/bin/phpunit

License

The MIT License (MIT). Please see License File for more information.

SymfonyInsight

SymfonyInsight