attla/flash-messages

Intuitive package to flash notifications on laravel.

dev-main 2022-09-25 01:07 UTC

This package is auto-updated.

Last update: 2024-10-25 05:42:28 UTC


README

License Latest Stable Version Total Downloads

✨ Intuitive package to flash notifications on laravel.

Installation

composer require attla/flash-messages

Configuration

To publish the configuration file, run the following command:

php artisan vendor:publish --tag=attla/flash-messages/config

The types array on configuration is usaded to indicate the class to the message.

The icons are default icons for each message type.

Usage

For create a new message you call the facade method as the type name from the configuration

use Attla\Flash\Facade as Flash;

// Create a flash message with the helper function
$flash = flash('Example of message', 'info');
// Create with facade
$flash = Flash::info('Example of message');

// Set the message as dismissible
$flash->dismissible();

// Set a custom class for the message
$flash->class('custom-message-class');

// Set a icon for the message
$flash->icon('far fa-circle-info');
$flash->icon('<i class="far fa-circle-info"></i>');

// Set a timeout for the message
$flash->timeout(6); // will be removed after 6 seconds

// If needed, you can unqueue the message
$flash->destory();

List of message methods

License

This package is licensed under the MIT license © Octha.