mazarini/message-bundle

Display alerts on webpage.

Installs: 23

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 0

Open Issues: 0

Type:symfony-bundle

v1.0.0 2023-12-20 21:55 UTC

This package is auto-updated.

Last update: 2024-11-19 23:36:02 UTC


README

Display alerts on webpage for symfony using alert from bootstrap.

Installation

foo@bar:~$ composer require mazarini/message-bundle

Add alerts with twig

In template/base.html.twig :

{% include('@MazariniMessage/_messages.html.twig') %}

Display alerts in create order

In each controller :

<?php
...
use Mazarini\MessageBundle\Controller\MessageControllerTrait;
...
class HomeController extends AbstractController
{
    use MessageControllerTrait;
...
}

Default configuration

foo@bar:~$ symfony console debug:config MazariniMessageBundle

Current configuration for "MazariniMessageBundle"
=================================================

mazarini_message:
    default: alert-danger
    types:
        primary: alert-primary
        secondary: alert-secondary
        success: alert-success
        danger: alert-danger
        error: alert-danger
        warning: alert-warning
        info: alert-info
        light: alert-light
        dark: alert-dark

foo@bar:~$

"types" is use to translate type of messages to class of alerts. By default, bootstrap classes are defines but other can be use.