yiirocks/toast-bootstrap5

Bootstrap 5 toast notifications backed by Yii3 session flash messages

Maintainers

Package info

github.com/YiiRocks/toast-bootstrap5

Homepage

pkg:composer/yiirocks/toast-bootstrap5

Transparency log

Fund package maintenance!

YiiRocks

Statistics

Installs: 5

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

dev-main / 1.0.x-dev 2026-08-03 19:45 UTC

This package is auto-updated.

Last update: 2026-08-03 19:46:59 UTC


README

Bootstrap 5 toast notifications for Yii framework 3.0, backed by yiisoft/session flash messages. Queue a message from a controller, echo $toast in your layout, done - no manual partials, no custom JS.

Packagist Version PHP from Packagist Packagist GitHub License GitHub Workflow Status

Stats for Nerds

Coverage MSI Tests Assertions

Requirements

  • PHP 8.3+
  • Bootstrap 5's JS bundle loaded on the page (for dismiss/autohide behavior)

Installation

The package could be installed via composer:

composer require yiirocks/toast-bootstrap5

Optionally, add Bootstrap Icons per message type:

composer require yiirocks/svg-inline-bootstrap

Usage

Queue a message from a controller or anywhere else FlashToastInterface is available:

public function __construct(private FlashToastInterface $toast) {}

public function actionSave(): ResponseInterface
{
    // ...
    $this->toast->success('Changes saved.');

    return $this->redirect('...');
}

Then echo $toast once in your layout - the default configuration injects it into every view:

<?= $toast ?>

Nothing renders until a message is pending. Four types are available (success, error, warning, info), each mapped to a Bootstrap 5 text-bg-* color, and multiple messages of the same type stack as separate toasts.

Available options (auto-hide delay per type, icon per type, container position) can be found in the documentation.

Unit testing

The package is tested with Psalm, PHPUnit and Infection mutation testing. To run tests:

composer psalm
composer phpunit
composer infection